Public report of 1jehuang/jcode, published 27 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, 27 October 2026, 01:32 UTC · Survey ID cd_cba7327e63b84abda8de3e78a7833d16

1jehuang/jcode

Measured 27 October 2026, 01:06 UTC, at code version a5cca86

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 55out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 1 since the last survey

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

A very large codebase: 679,090 lines of product code in 101 projects, tests not counted · Estimated rebuild effort: about 6.0 person-years · Weakest lens: Code Health, 47

Findings by how serious they are

134 critical 3752 serious 139 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
27 October 2026, 01:06 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 ▸

80of 80 dimensions measured by tools.
3927of 4025 findings point to an exact file and line, so you can open each one in the code. The other 98 concern the repository as a whole, such as missing documentation.
80dimensions across 8 lenses, read from 679,090 lines of product code in 101 projects.
Chapters

Executive summary

1jehuang/jcode falls short of our standard for a preview release, held back most by its Code Health lens, the quality of the code itself. It scores 55 out of 100 and is rated Adequate, and 128 of its 134 critical findings are security problems.

Code Health, at 47, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the four exposed passwords or keys and switching the old ones off, worth about 3 points. Adding type checking would lift Code Health itself, worth about 5 points. Raising Code Health to 67 would lift the score to about 60.

111 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Six secrets can leak from the build pipeline, and four passwords or keys in the code and one in the code's history are open to anyone who can read the repository. Pinning each tool to an exact version, limiting each secret to its own step and replacing each exposed password or key would close these risks. Fixing the weaknesses the scanner points to would fix the two security weaknesses in the code, and the two pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The four sets of files in separate parts that keep changing together need that dependency made explicit.

The product code is 679,090 lines, about €870,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Code Health 47 · counts for 45%Security and Compliance 54 · counts for 25%Production Readiness 56 · counts for 14%Performance 70 · counts for 8%Maturity 81 · counts for 4%Architecture 88 · counts for 2%Event-Driven 100 · counts for 1%Event Sourcing 100 · counts for 1%

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

Code composition: what the lines of code are
Product code 78%Tests 22%
New since the last survey: 553 findings

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

  • Cyclomatic Complexity · jcode_app_core::server::runtime_commands::execute (cyclomatic 70) crates/jcode-app-core/src/server/runtime_commands.rs
  • Cyclomatic Complexity · jcode_app_core::tool::browser_request::bridge_request (cyclomatic 70) crates/jcode-app-core/src/tool/browser_request.rs
  • Cyclomatic Complexity · fetch (cyclomatic 61) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · App::build_model_picker_entries (cyclomatic 52) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · MultiProvider::cross_provider_pool_prompt (cyclomatic 41) crates/jcode-base/src/provider/multi_provider.rs
  • Cyclomatic Complexity · jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request (cyclomatic 40) crates/jcode-app-core/src/server/client_lightweight_control.rs
  • Cyclomatic Complexity · jcode_tui_tool_display::parse_tool_failure (cyclomatic 39) crates/jcode-tui-tool-display/src/lib.rs
  • Cyclomatic Complexity · oauth-account.oauthAccount (cyclomatic 38) telemetry-worker/src/oauth-account.js
  • Cyclomatic Complexity · normalizeUsageReportEvent (cyclomatic 38) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · jcode_provider_core::pricing::openai_api_pricing_with_tier (cyclomatic 34) crates/jcode-provider-core/src/pricing.rs
  • Cyclomatic Complexity · jcode_app_core::server::group_transfer::handle_with_gate (cyclomatic 33) crates/jcode-app-core/src/server/group_transfer.rs
  • Cyclomatic Complexity · AuthStatus::method_detail_for_provider (cyclomatic 33) crates/jcode-base/src/auth/status_detail.rs
  • Cyclomatic Complexity · jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cyclomatic 33) crates/jcode-base/src/provider/catalog_remote_routes.rs
  • Cyclomatic Complexity · App::schedule_auto_poke_followup_after_response (cyclomatic 33) crates/jcode-tui/src/tui/app/input.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands_cloud::finish_cloud_command (cyclomatic 33) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · jcode_app_core::tool::todo::apply_todo_patch (cyclomatic 32) crates/jcode-app-core/src/tool/todo.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::server_events::handle_kv_cache_miss (cyclomatic 32) crates/jcode-tui/src/tui/app/remote/server_events.rs
  • Cyclomatic Complexity · jcode::cli::cloud_group_run::run_migrate (cyclomatic 32) src/cli/cloud_group_run.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::model_context_commands::handle_model_command (cyclomatic 31) crates/jcode-tui/src/tui/app/model_context_commands.rs
  • Cyclomatic Complexity · jcode_base::mcp::remote::streamable_post_inner (cyclomatic 30) crates/jcode-base/src/mcp/remote.rs
  • Cyclomatic Complexity · FollowUpPolicy::decide_after_turn (cyclomatic 30) crates/jcode-todo-policy/src/followup.rs
  • Cyclomatic Complexity · jcode::cli::cloud_move::run_move (cyclomatic 30) src/cli/cloud_move.rs
  • Cyclomatic Complexity · jcode_base::auth::transfer::import_cloud_inner (cyclomatic 29) crates/jcode-base/src/auth/transfer.rs
  • Cyclomatic Complexity · jcode_todo_policy::completion_report::render_completion_report (cyclomatic 28) crates/jcode-todo-policy/src/completion_report.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_input::live_processing_status_line (cyclomatic 28) crates/jcode-tui/src/tui/ui_input.rs
  • Cyclomatic Complexity · jcode_provider_openai::citations::render_annotated_text (cyclomatic 27) crates/jcode-provider-openai/src/citations.rs
  • Cyclomatic Complexity · App::handle_login_completed (cyclomatic 27) crates/jcode-tui/src/tui/app/auth.rs
  • Cyclomatic Complexity · check_release_ci.check_once (cyclomatic 26) scripts/check_release_ci.py
  • Cyclomatic Complexity · App::open_account_picker (cyclomatic 24) crates/jcode-tui/src/tui/app/auth_account_picker.rs
  • Cyclomatic Complexity · SessionPicker::run_with_session_updates (cyclomatic 24) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame (cyclomatic 24) crates/jcode-tui-mermaid/src/mermaid_kitty_classic.rs
  • Cyclomatic Complexity · jcode_base::mcp::oauth::www_authenticate_param (cyclomatic 23) crates/jcode-base/src/mcp/oauth.rs
  • Cyclomatic Complexity · jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response (cyclomatic 23) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs
  • Cyclomatic Complexity · jcode_telemetry_core::session_outcome::infer_session_stop_reason (cyclomatic 23) crates/jcode-telemetry-core/src/session_outcome.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands_cloud::start_cloud_command (cyclomatic 23) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · jcode::cli::cloud_group_receive::activate (cyclomatic 23) src/cli/cloud_group_receive.rs
  • Cyclomatic Complexity · jcode::cli::commands::prepare_run_todo_follow_up (cyclomatic 23) src/cli/commands.rs
  • Cyclomatic Complexity · Projection::observe (cyclomatic 22) crates/jcode-app-core/src/server/live_status.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_special_commands::logout (cyclomatic 22) crates/jcode-app-core/src/server/runtime_special_commands.rs
  • Cyclomatic Complexity · jcode_app_core::tool::todo::prepare_background_dependencies (cyclomatic 22) crates/jcode-app-core/src/tool/todo.rs
  • Cyclomatic Complexity · MultiProvider::compute_fresh_session_pool_route (cyclomatic 22) crates/jcode-base/src/provider/startup.rs
  • Cyclomatic Complexity · jcode_telemetry_core::oauth_account::handle_in (cyclomatic 22) crates/jcode-telemetry-core/src/oauth_account.rs
  • Cyclomatic Complexity · App::start_muse_subscription_login (cyclomatic 22) crates/jcode-tui/src/tui/app/auth/auth_muse.rs
  • Cyclomatic Complexity · App::offer_fallback_after_error_with_payload (cyclomatic 22) crates/jcode-tui/src/tui/app/model_context.rs
  • Cyclomatic Complexity · TodoTool::execute (cyclomatic 21) crates/jcode-app-core/src/tool/todo.rs
  • Cyclomatic Complexity · App::handle_usage_reset_command (cyclomatic 21) crates/jcode-tui/src/tui/app/usage_reset.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_stages::agent_roster_spans (cyclomatic 21) crates/jcode-tui/src/tui/ui_todo_stages.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_stages::push_stage_lines (cyclomatic 21) crates/jcode-tui/src/tui/ui_todo_stages.rs
  • Cyclomatic Complexity · bench_resume_picker.measure (cyclomatic 21) scripts/bench_resume_picker.py
  • Cyclomatic Complexity · MultiProvider::is_failover_route_pool_approved (cyclomatic 20) crates/jcode-base/src/provider/multi_provider.rs
  • Cyclomatic Complexity · RouteSelection::routed_model_spec (cyclomatic 20) crates/jcode-provider-core/src/lib.rs
  • Cyclomatic Complexity · App::poll_model_picker_load (cyclomatic 20) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · App::widget_usage_info_inner (cyclomatic 20) crates/jcode-tui/src/tui/app/tui_state.rs
  • Cyclomatic Complexity · App::classify_kv_cache_miss_reason (cyclomatic 20) crates/jcode-tui/src/tui/app.rs
  • Cyclomatic Complexity · SessionPicker::render_preview (cyclomatic 19) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::render_todos_message_with_cap (cyclomatic 19) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode::cli::cloud_env::exchange_bounded (cyclomatic 19) src/cli/cloud_env.rs
  • Cyclomatic Complexity · jcode::cli::commands::run_browser (cyclomatic 19) src/cli/commands.rs
  • Cyclomatic Complexity · apply_release_recovery.apply (cyclomatic 19) scripts/apply_release_recovery.py
  • Cyclomatic Complexity · DeflateStream::accept_write (cyclomatic 18) crates/jcode-provider-core/src/ws_deflate.rs
  • Cyclomatic Complexity · App::format_usage_display_card (cyclomatic 18) crates/jcode-tui/src/tui/app/model_context.rs
  • Cyclomatic Complexity · jcode_tui::tui::cloud_status::parse (cyclomatic 18) crates/jcode-tui/src/tui/cloud_status.rs
  • Cyclomatic Complexity · jcode_tui::tui::info_widget_git::render_dual_git (cyclomatic 18) crates/jcode-tui/src/tui/info_widget_git.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::render_system_message (cyclomatic 18) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode::cli::ssh_transport::accept_connections (cyclomatic 18) REDACTED
  • Cyclomatic Complexity · jcode_app_core::server::client_lifecycle::start_processing_message (cyclomatic 17) crates/jcode-app-core/src/server/client_lifecycle.rs
  • Cyclomatic Complexity · jcode_app_core::server::client_session::rename_swarm_member_session (cyclomatic 17) crates/jcode-app-core/src/server/client_session.rs
  • Cyclomatic Complexity · jcode_app_core::server::comm_plan::handle_comm_propose_plan (cyclomatic 17) crates/jcode-app-core/src/server/comm_plan.rs
  • Cyclomatic Complexity · jcode_app_core::server::comm_session::spawn_swarm_agent (cyclomatic 17) crates/jcode-app-core/src/server/comm_session.rs
  • Cyclomatic Complexity · jcode_app_core::server::comm_session::handle_comm_stop (cyclomatic 17) crates/jcode-app-core/src/server/comm_session.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_special_commands::overnight (cyclomatic 17) crates/jcode-app-core/src/server/runtime_special_commands.rs
  • Cyclomatic Complexity · MultiProvider::fresh_routes_memo_entry (cyclomatic 17) crates/jcode-base/src/provider/catalog_memo.rs
  • Cyclomatic Complexity · jcode_base::kv_cache_monitor::reason (cyclomatic 17) crates/jcode-base/src/kv_cache_monitor.rs
  • Cyclomatic Complexity · jcode_base::provider::models_catalog::parse_openai_model_catalog (cyclomatic 17) crates/jcode-base/src/provider/models_catalog.rs
  • Cyclomatic Complexity · App::new_for_remote_with_options (cyclomatic 17) crates/jcode-tui/src/tui/app/tui_lifecycle.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_header::account_router::inventory_lines (cyclomatic 17) crates/jcode-tui/src/tui/ui_header/account_router.rs
  • Cyclomatic Complexity · jcode::cli::cloud_ephemeral::run_cli (cyclomatic 17) src/cli/cloud_ephemeral.rs
  • Cyclomatic Complexity · jcode::cli::cloud_move::restore_repo (cyclomatic 17) src/cli/cloud_move.rs
  • Cyclomatic Complexity · H.do_POST (cyclomatic 17) scripts/fake_openai_server.py
  • Cyclomatic Complexity · Agent::export_conversation_markdown (cyclomatic 16) crates/jcode-app-core/src/agent/messages.rs
  • Cyclomatic Complexity · MultiProvider::fork_model_switch_request (cyclomatic 16) crates/jcode-base/src/provider/mod.rs
  • Cyclomatic Complexity · MultiProvider::model_switch_request_for_session_model (cyclomatic 16) crates/jcode-base/src/provider/selection.rs
  • Cyclomatic Complexity · Session::save_inner (cyclomatic 16) crates/jcode-base/src/session/persistence.rs
  • Cyclomatic Complexity · jcode_base::auth::router_transfer::import_at (cyclomatic 16) crates/jcode-base/src/auth/router_transfer.rs
  • Cyclomatic Complexity · jcode_base::kv_cache_monitor::describe_miss (cyclomatic 16) crates/jcode-base/src/kv_cache_monitor.rs
  • Cyclomatic Complexity · jcode_base::provider::catalog_routes::expand_saved_account_routes (cyclomatic 16) crates/jcode-base/src/provider/catalog_routes.rs
  • Cyclomatic Complexity · App::start_logout_all (cyclomatic 16) crates/jcode-tui/src/tui/app/auth.rs
  • Cyclomatic Complexity · Snapshot::row (cyclomatic 16) crates/jcode-tui/src/tui/justrust_status.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands::handle_telemetry_command (cyclomatic 16) crates/jcode-tui/src/tui/app/commands.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands_cloud::parse_cloud_command (cyclomatic 16) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::todo_card_item_spans (cyclomatic 16) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_changes::compute_diff (cyclomatic 16) crates/jcode-tui/src/tui/ui_todo_changes.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_stages::push_lane_status_lines (cyclomatic 16) crates/jcode-tui/src/tui/ui_todo_stages.rs
  • Cyclomatic Complexity · jcode::cli::commands::run_single_message_command_plain_with_auto_poke (cyclomatic 16) src/cli/commands.rs
  • Cyclomatic Complexity · jcode::cli::commands::run_single_message_command_capture_with_auto_poke (cyclomatic 16) src/cli/commands.rs
  • Cognitive Complexity · App::build_model_picker_entries (cognitive 97) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cognitive Complexity · jcode_app_core::server::runtime_commands::execute (cognitive 79) crates/jcode-app-core/src/server/runtime_commands.rs
  • Cognitive Complexity · jcode_app_core::server::group_transfer::handle_with_gate (cognitive 70) crates/jcode-app-core/src/server/group_transfer.rs
  • Cognitive Complexity · fetch (cognitive 68) telemetry-worker/src/worker.js
  • Cognitive Complexity · jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cognitive 66) crates/jcode-base/src/provider/catalog_remote_routes.rs

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

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

  • Cyclomatic Complexity · App::open_model_picker_with_routes (cyclomatic 75) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · jcode_app_core::tool::browser::bridge_request (cyclomatic 71) crates/jcode-app-core/src/tool/browser.rs
  • Cyclomatic Complexity · fetch (cyclomatic 46) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · jcode_base::provider::catalog_routes::remote_model_routes_fallback (cyclomatic 32) crates/jcode-base/src/provider/catalog_routes.rs
  • Cyclomatic Complexity · AuthStatus::method_detail_for_provider (cyclomatic 31) crates/jcode-base/src/auth/mod.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::model_context::handle_model_command (cyclomatic 31) crates/jcode-tui/src/tui/app/model_context.rs
  • Cyclomatic Complexity · FollowUpPolicy::decide (cyclomatic 26) crates/jcode-todo-policy/src/followup.rs
  • Cyclomatic Complexity · App::schedule_auto_poke_followup_if_needed (cyclomatic 26) crates/jcode-tui/src/tui/app/input.rs
  • Cyclomatic Complexity · jcode_app_core::server::debug_swarm_write::handle_debug_graph_op (cyclomatic 23) crates/jcode-app-core/src/server/debug_swarm_write.rs
  • Cyclomatic Complexity · jcode_telemetry_core::infer_session_stop_reason (cyclomatic 23) crates/jcode-telemetry-core/src/lib.rs
  • Cyclomatic Complexity · jcode_plan::dag::ops::inject_from_gate (cyclomatic 21) crates/jcode-plan/src/dag/ops.rs
  • Cyclomatic Complexity · jcode_app_core::server::comm_control::spawn_assigned_task_run (cyclomatic 20) crates/jcode-app-core/src/server/comm_control.rs
  • Cyclomatic Complexity · jcode_base::auth::transfer::secure_publish (cyclomatic 20) crates/jcode-base/src/auth/transfer.rs
  • Cyclomatic Complexity · jcode_plan::dag::ops::expand_node (cyclomatic 19) crates/jcode-plan/src/dag/ops.rs
  • Cyclomatic Complexity · Agent::export_conversation_markdown (cyclomatic 16) crates/jcode-app-core/src/agent.rs
  • Cyclomatic Complexity · App::widget_usage_info (cyclomatic 16) crates/jcode-tui/src/tui/app/tui_state.rs
  • Cyclomatic Complexity · SessionPicker::run (cyclomatic 16) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands_cloud::handle_cloud_command (cyclomatic 16) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · jcode_tui::tui::info_widget_todos::push_todo_item_line (cyclomatic 16) crates/jcode-tui/src/tui/info_widget_todos.rs
  • Cyclomatic Complexity · jcode_tui_tool_display::concise_tool_error_summary (cyclomatic 16) crates/jcode-tui-tool-display/src/lib.rs
  • Cognitive Complexity · App::open_model_picker_with_routes (cognitive 140) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cognitive Complexity · jcode_base::provider::catalog_routes::remote_model_routes_fallback (cognitive 63) crates/jcode-base/src/provider/catalog_routes.rs
  • Cognitive Complexity · jcode_app_core::tool::browser::bridge_request (cognitive 57) crates/jcode-app-core/src/tool/browser.rs
  • Cognitive Complexity · AuthStatus::method_detail_for_provider (cognitive 56) crates/jcode-base/src/auth/mod.rs
  • Cognitive Complexity · fetch (cognitive 51) telemetry-worker/src/worker.js
  • Cognitive Complexity · jcode_tui::tui::app::model_context::handle_model_command (cognitive 47) crates/jcode-tui/src/tui/app/model_context.rs
  • Cognitive Complexity · App::schedule_auto_poke_followup_if_needed (cognitive 37) crates/jcode-tui/src/tui/app/input.rs
  • Cognitive Complexity · jcode_app_core::server::debug_swarm_write::handle_debug_graph_op (cognitive 36) crates/jcode-app-core/src/server/debug_swarm_write.rs
  • Cognitive Complexity · jcode_app_core::tool::browser_jev::request_body (cognitive 32) crates/jcode-app-core/src/tool/browser_jev.rs
  • Cognitive Complexity · jcode_tui::tui::ui_messages::render_todos_message (cognitive 32) crates/jcode-tui/src/tui/ui_messages.rs
  • Cognitive Complexity · FollowUpPolicy::decide (cognitive 29) crates/jcode-todo-policy/src/followup.rs
  • Cognitive Complexity · jcode_plan::dag::ops::inject_from_gate (cognitive 28) crates/jcode-plan/src/dag/ops.rs
  • Cognitive Complexity · jcode_base::auth::transfer::secure_publish (cognitive 26) crates/jcode-base/src/auth/transfer.rs
  • Cognitive Complexity · jcode_plan::dag::ops::expand_node (cognitive 24) crates/jcode-plan/src/dag/ops.rs
  • Cognitive Complexity · SessionPicker::run (cognitive 24) crates/jcode-tui/src/tui/session_picker.rs
  • Cognitive Complexity · jcode_tui_tool_display::concise_tool_error_summary (cognitive 24) crates/jcode-tui-tool-display/src/lib.rs
  • Cognitive Complexity · Agent::export_conversation_markdown (cognitive 22) crates/jcode-app-core/src/agent.rs
  • Cognitive Complexity · jcode_telemetry_core::infer_session_stop_reason (cognitive 22) crates/jcode-telemetry-core/src/lib.rs
  • Cognitive Complexity · jcode_tui::tui::info_widget_todos::push_todo_pips (cognitive 22) crates/jcode-tui/src/tui/info_widget_todos.rs
  • Cognitive Complexity · jcode_plan::dag::ops::seed (cognitive 21) crates/jcode-plan/src/dag/ops.rs
  • Cognitive Complexity · jcode_tui::tui::ui::render_native_scrollbar (cognitive 21) crates/jcode-tui/src/tui/ui.rs
  • Cognitive Complexity · jcode_base::prompt::get_git_info (cognitive 20) crates/jcode-base/src/prompt.rs
  • Cognitive Complexity · jcode_tui::tui::ui_input::command_suggestion_lines (cognitive 20) crates/jcode-tui/src/tui/ui_input.rs
  • Cognitive Complexity · jcode_base::memory::bm25_rank (cognitive 19) crates/jcode-base/src/memory.rs
  • Cognitive Complexity · jcode_tui::tui::info_widget_todos::push_todo_item_line (cognitive 19) crates/jcode-tui/src/tui/info_widget_todos.rs
  • Cognitive Complexity · jcode_plan::dag::ops::ensure_root_gate (cognitive 18) crates/jcode-plan/src/dag/ops.rs
  • Cognitive Complexity · App::format_compaction_detail_segments (cognitive 18) crates/jcode-tui/src/tui/app/conversation_state.rs
  • Cognitive Complexity · jcode_tui::tui::ui_messages::render_gmail_draft_card (cognitive 18) crates/jcode-tui/src/tui/ui_messages.rs
  • Cognitive Complexity · jcode_app_core::tool::replace::collect_files (cognitive 17) crates/jcode-app-core/src/tool/replace.rs
  • Cognitive Complexity · jcode_protocol::comm_format::format_comm_plan_status (cognitive 17) crates/jcode-protocol/src/comm_format.rs
  • Cognitive Complexity · App::show_jcode_subscription_status (cognitive 17) crates/jcode-tui/src/tui/app/auth.rs
  • Cognitive Complexity · ReplaceTool::execute (cognitive 16) crates/jcode-app-core/src/tool/replace.rs
  • Cognitive Complexity · App::apply_restored_reload_input (cognitive 16) crates/jcode-tui/src/tui/app/tui_lifecycle.rs
  • Cognitive Complexity · jcode_tui::tui::app::helpers::gather_todos_and_goals_for_session (cognitive 16) crates/jcode-tui/src/tui/app/helpers.rs
  • Cognitive Complexity · jcode_tui::tui::info_widget::render_sections (cognitive 16) crates/jcode-tui/src/tui/info_widget.rs
  • Cognitive Complexity · jcode_tui::tui::ui_messages::render_usage_message (cognitive 16) crates/jcode-tui/src/tui/ui_messages.rs
  • God Classes · MethodTooLong: App.open_model_picker_with_routes crates/jcode-tui/src/tui/app/inline_interactive.rs
  • God Classes · FunctionTooLong: jcode_tui::tui::app::model_context::handle_model_command crates/jcode-tui/src/tui/app/model_context.rs
  • God Classes · ClassTooLong: AnthropicProvider crates/jcode-provider-anthropic-runtime/src/lib.rs
  • God Classes · FunctionTooLong: jcode_provider_anthropic_runtime::run_stream_with_retries crates/jcode-provider-anthropic-runtime/src/lib.rs
  • God Classes · MethodTooLong: App.schedule_auto_poke_followup_if_needed crates/jcode-tui/src/tui/app/input.rs
  • God Classes · FunctionTooLong: jcode_base::provider::catalog_routes::remote_model_routes_fallback crates/jcode-base/src/provider/catalog_routes.rs
  • God Classes · MethodTooLong: App.widget_usage_info crates/jcode-tui/src/tui/app/tui_state.rs
  • God Classes · FunctionTooLong: jcode_provider_anthropic_runtime::stream_response crates/jcode-provider-anthropic-runtime/src/lib.rs
  • God Classes · ClassTooLong: ServerEvent crates/jcode-protocol/src/wire.rs
  • God Classes · FunctionTooLong: jcode_provider_anthropic_runtime::process_sse_event crates/jcode-provider-anthropic-runtime/src/lib.rs
  • God Classes · FunctionTooLong: jcode::cli::dispatch::map_cloud_sessions_subcommand src/cli/dispatch.rs
  • God Classes · FileTooLong: dag/ops.rs crates/jcode-plan/src/dag/ops.rs
  • God Classes · FunctionTooLong: jcode_app_core::tool::browser_jev::request_body crates/jcode-app-core/src/tool/browser_jev.rs
  • God Classes · MethodTooLong: Registry.base_tools crates/jcode-app-core/src/tool/mod.rs
  • God Classes · FunctionTooLong: jcode_tui::tui::ui_messages::render_gmail_draft_card crates/jcode-tui/src/tui/ui_messages.rs
  • God Classes · MethodTooLong: App.handle_key_core crates/jcode-tui/src/tui/app/input.rs
  • Code Duplication · Near-duplicate member pair (93 shared lines) crates/jcode-provider-anthropic-runtime/src/lib.rs
  • Code Duplication · Near-duplicate member pair (87 shared lines) crates/jcode-tui-mermaid/src/mermaid_widget.rs
  • Code Duplication · Near-duplicate member pair (39 shared lines) crates/jcode-tui/src/tui/app/remote/reconnect.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) crates/jcode-tui/src/tui/ui.rs
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) crates/jcode-provider-doctor/src/live_provider_probes.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/jcode-tui/src/tui/ui_messages.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/jcode-app-core/src/tool/read.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/jcode-tui/src/tui/ui.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/jcode-app-core/src/perf.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/check_code_size_budget.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/check_code_size_budget.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py
  • Code Duplication · Duplicated block (40 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs
  • Code Duplication · Duplicated block (30–35 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs
  • Code Duplication · Duplicated block (28–30 lines × 2) crates/jcode-tui/src/tui/app.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/jcode-tui-mermaid/src/mermaid_viewport.rs
  • Code Duplication · Duplicated block (25 lines × 2) crates/jcode-tui/src/tui/info_widget_todos.rs
  • Code Duplication · Duplicated block (22–24 lines × 2) crates/jcode-app-core/src/server/client_comm_context.rs
  • Code Duplication · Duplicated block (21 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Code Duplication · Duplicated block (20 lines × 3) crates/jcode-provider-anthropic-runtime/src/lib.rs
  • Code Duplication · Duplicated block (18 lines × 2) crates/jcode-app-core/src/server/comm_graph.rs
  • Code Duplication · Duplicated block (17 lines × 2) crates/jcode-app-core/src/tool/communicate.rs
Rebuild cost: about €870,000 · Estimate
Cost to rebuild€290,000 to €1,500,000, for 4,832 to 15,328 hours of work, about 6.0 person-years for 3 to 12 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 55. 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: 679,090 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.
Raises the score by about 3 points · Low effort · REDACTED Scanning
2
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 5 points · Medium effort · Type Safety
3
Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs).
Skip if delegated to infra (Postgres TDE, KMS, etc.).
Raises the score by about 3 points · Medium effort · Data Protection

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 €870,000 to build again, about 6.0 person-years of work. Its weakest lens is Code Health, at 47 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 4 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 5% to 10% on every change. The history of the code shows how much it changes: about 518,130 lines over the last 90 days, which is about 2,101,305 lines a year. At that pace, the extra work comes to an estimated 245 to 1470 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

arch jcode (.) ) jcode-provider-antigravity-runtime jcode-provider-antigravity-runtime jcode (.)->jcode-provider-antigravity-runtime jcode-provider-copilot-runtime jcode-provider-copilot-runtime jcode (.)->jcode-provider-copilot-runtime jcode-provider-doctor jcode-provider-doctor jcode (.)->jcode-provider-doctor jcode-provider-openrouter-runtime jcode-provider-openrouter-runtime jcode (.)->jcode-provider-openrouter-runtime jcode-tui jcode-tui jcode (.)->jcode-tui jcode-app-core jcode-app-core jcode-base jcode-base jcode-app-core->jcode-base jcode-core jcode-core jcode-app-core->jcode-core jcode-harness-api jcode-harness-api jcode-app-core->jcode-harness-api jcode-message-types jcode-message-types jcode-app-core->jcode-message-types jcode-provider-core jcode-provider-core jcode-app-core->jcode-provider-core jcode-schema-dialect jcode-schema-dialect jcode-app-core->jcode-schema-dialect jcode-session-types jcode-session-types jcode-app-core->jcode-session-types jcode-base->jcode-core jcode-logging jcode-logging jcode-base->jcode-logging jcode-base->jcode-message-types jcode-protocol jcode-protocol jcode-base->jcode-protocol jcode-provider-bedrock jcode-provider-bedrock jcode-base->jcode-provider-bedrock jcode-base->jcode-provider-core jcode-provider-openai jcode-provider-openai jcode-base->jcode-provider-openai jcode-base->jcode-session-types jcode-storage jcode-storage jcode-base->jcode-storage jcode-telemetry-core jcode-telemetry-core jcode-base->jcode-telemetry-core jcode-harness-api->jcode-session-types jcode-logging->jcode-core jcode-logging->jcode-storage jcode-protocol->jcode-message-types jcode-protocol->jcode-provider-core jcode-protocol->jcode-session-types jcode-provider-antigravity-runtime->jcode-base jcode-provider-antigravity-runtime->jcode-message-types jcode-provider-antigravity-runtime->jcode-provider-core jcode-provider-antigravity-runtime->jcode-schema-dialect jcode-provider-bedrock->jcode-core jcode-provider-bedrock->jcode-logging jcode-provider-bedrock->jcode-message-types jcode-provider-bedrock->jcode-provider-core jcode-provider-bedrock->jcode-storage jcode-provider-copilot-runtime->jcode-base jcode-provider-copilot-runtime->jcode-message-types jcode-provider-copilot-runtime->jcode-provider-core jcode-provider-copilot-runtime->jcode-provider-openai jcode-provider-core->jcode-logging jcode-provider-core->jcode-message-types jcode-provider-core->jcode-schema-dialect jcode-provider-doctor->jcode-base jcode-provider-doctor->jcode-provider-antigravity-runtime jcode-provider-doctor->jcode-provider-copilot-runtime jcode-provider-doctor->jcode-provider-openrouter-runtime jcode-provider-openai->jcode-core jcode-provider-openai->jcode-logging jcode-provider-openai->jcode-message-types jcode-provider-openai->jcode-provider-core jcode-provider-openrouter-runtime->jcode-base jcode-provider-openrouter-runtime->jcode-message-types jcode-provider-openrouter-runtime->jcode-provider-core jcode-provider-openrouter-runtime->jcode-provider-openai jcode-session-types->jcode-message-types jcode-storage->jcode-core jcode-telemetry-core->jcode-core jcode-telemetry-core->jcode-logging jcode-telemetry-core->jcode-provider-core jcode-telemetry-core->jcode-storage jcode-tui->jcode-app-core jcode-tui->jcode-core jcode-tui->jcode-logging jcode-tui->jcode-provider-core jcode-tui->jcode-session-types __more__ +81 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.

1030 modules, with 1667 dependencies between them. 15 loops run through 55 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 990 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 jcode_base.mcp.protocol2 jcode_config_types3 jcode_memory_types4 jcode_protocol.wire.events5 jcode_provider_metadata6 jcode_sdk.errors7 jcode_side_panel_types8 jcode_task_types9 jcode_transport.windows10 jcode_voice.capture11 scripts12 jcode_base.auth.status_types13 jcode_message_types14 jcode_provider_core15 jcode.cli.provider_init16 jcode_base.bus17 jcode_telemetry_core18 jcode_tool_core19 jcode_app_core.tool20 jcode_usage_types21 jcode_base.usage.model22 jcode_harness_api.events23 jcode_protocol24 jcode_sdk.client25 jcode_app_core.server.client_api26 jcode_app_core.server.state27 jcode_base.config28 jcode_tui.tui.info_widget29 jcode_app_core.server30 jcode_base.gmail31 jcode_base.mcp.remote32 jcode_base.provider33 jcode_telemetry_core.oauth_account34 jcode_session_types35 jcode_base.session36 jcode_tui_messages.message37 jcode_app_core.agent38 jcode_tui.tui.app39 jcode_tui.tui40 jcode.bin.tui_bench
1 jcode_base.mcp.protocol
2 jcode_config_types
3 jcode_memory_types
4 jcode_protocol.wire.events
5 jcode_provider_metadata
6 jcode_sdk.errors
7 jcode_side_panel_types
8 jcode_task_types
9 jcode_transport.windows
10 jcode_voice.capture
11 scripts
12 jcode_base.auth.status_types2
13 jcode_message_types22
14 jcode_provider_core111
15 jcode.cli.provider_init231
16 jcode_base.bus111
17 jcode_telemetry_core114
18 jcode_tool_core1
19 jcode_app_core.tool11
20 jcode_usage_types1
21 jcode_base.usage.model1
22 jcode_harness_api.events1
23 jcode_protocol122
24 jcode_sdk.client32
25 jcode_app_core.server.client_api11
26 jcode_app_core.server.state112
27 jcode_base.config201
28 jcode_tui.tui.info_widget231
29 jcode_app_core.server112
30 jcode_base.gmail1
31 jcode_base.mcp.remote21
32 jcode_base.provider41171
33 jcode_telemetry_core.oauth_account11
34 jcode_session_types1231
35 jcode_base.session112216
36 jcode_tui_messages.message11
37 jcode_app_core.agent1123521121141
38 jcode_tui.tui.app4121211117811137111121215
39 jcode_tui.tui32111312112
40 jcode.bin.tui_bench32111111223
Uses a module listed above itPart of a loopThe module itself
1 jcode_base.mcp.protocol2 jcode_config_types3 jcode_memory_types4 jcode_protocol.wire.events5 jcode_provider_metadata6 jcode_sdk.errors7 jcode_side_panel_types8 jcode_task_types9 jcode_transport.windows10 jcode_voice.capture11 scripts12 jcode_base.auth.status_types13 jcode_message_types14 jcode_provider_core15 jcode.cli.provider_init16 jcode_base.bus17 jcode_telemetry_core18 jcode_tool_core19 jcode_app_core.tool20 jcode_usage_types21 jcode_base.usage.model22 jcode_harness_api.events23 jcode_protocol24 jcode_sdk.client25 jcode_app_core.server.client_api26 jcode_app_core.server.state27 jcode_base.config28 jcode_tui.tui.info_widget29 jcode_app_core.server30 jcode_base.gmail31 jcode_base.mcp.remote32 jcode_base.provider33 jcode_telemetry_core.oauth_account34 jcode_session_types35 jcode_base.session36 jcode_tui_messages.message37 jcode_app_core.agent38 jcode_tui.tui.app39 jcode_tui.tui40 jcode.bin.tui_benchjcode_base.mcp.protocol1jcode_config_types2jcode_memory_types3jcode_protocol.wire.events4jcode_provider_metadata5jcode_sdk.errors6jcode_side_panel_types7jcode_task_types8jcode_transport.windows9jcode_voice.capture10scripts11jcode_base.auth.status_types12jcode_message_types13jcode_provider_core14jcode.cli.provider_init15jcode_base.bus16jcode_telemetry_core17jcode_tool_core18jcode_app_core.tool19jcode_usage_types20jcode_base.usage.model21jcode_harness_api.events22jcode_protocol23jcode_sdk.client24jcode_app_core.server.client_api25jcode_app_core.server.state26jcode_base.config27jcode_tui.tui.info_widget28jcode_app_core.server29jcode_base.gmail30jcode_base.mcp.remote31jcode_base.provider32jcode_telemetry_core.oauth_account33jcode_session_types34jcode_base.session35jcode_tui_messages.message36jcode_app_core.agent37jcode_tui.tui.app38jcode_tui.tui39jcode.bin.tui_bench4022211123111111411111112232111122012311121214117111123111221611112352112114141212111178111371111212153211131211232111111223+990 more modules (most-connected shown)

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

At a glance — Architecture · 88% · Exemplary ·

At a glance — Maturity · 81% · Strong ·

At a glance — Readiness · 56% · Adequate · gated by D13, P5 ·

At a glance — Security · 54% · Adequate · gated by D29, C1 ·

At a glance — Event-Driven · 100% · Exemplary ·

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

At a glance — Performance · 70% · 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 — Injection125High / Critical
A03:2025 — Software Supply Chain Failures18Medium
A07:2025 — Authentication Failures6High / Critical

Roadmap

Begin by establishing type safety in the frontend through a build-time check and incremental conversion of high-traffic modules, while simultaneously resolving the four identified secret leaks in test and script files. Next, implement encryption for sensitive data at rest and integrate a secure key management vault to strengthen data protection. Finally, maintain dependency hygiene by updating outdated packages and refactor the largest source file into smaller, focused modules to improve code manageability.

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

Do thisHelpsEffortDimension
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2), REDACTED, REDACTED.+3.3 ptsLowREDACTED Scanning
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.+5.0 ptsMediumType Safety
Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Skip if delegated to infra (Postgres TDE, KMS, etc.).+3.1 ptsMediumData Protection
Improve Dependency Hygiene — currently 8.0/10.+2.4 ptsMediumDependency Hygiene
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+2.0 ptsMediumLarge Files
Swallowed exception (empty catch)+1.7 ptsMediumException handling
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).+0.8 ptsLowStatic Analysis (SAST)
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.+1.4 ptsMediumCyclomatic Complexity

File quality

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

FileScoreBandWorst signal
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
crates/jcode-app-core/src/server/client_comm_context.rs4.9MixedCognitive Complexity: jcode_app_core::server::client_comm_context::handle_comm_share (cognitive 20)
REDACTED5.0MixedStatic Analysis (SAST): High: REDACTED
crates/jcode-app-core/src/tool/discover.rs5.0MixedChange Coupling: Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py
crates/jcode-tui/src/tui/app/remote/key_handling.rs5.5MixedCyclomatic Complexity: jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cyclomatic 219)
crates/jcode-tui-markdown/src/markdown_render_full.rs5.5MixedCyclomatic Complexity: jcode_tui_markdown::markdown_render_full::render_markdown_with_width (cyclomatic 149)
crates/jcode-harness-api-server/src/translate.rs5.5MixedCyclomatic Complexity: BridgeState::legacy_event_to_api (cyclomatic 137)
crates/jcode-app-core/src/server/comm_control.rs5.5MixedCyclomatic Complexity: jcode_app_core::server::comm_control::handle_comm_task_control (cyclomatic 42)
crates/jcode-tui/src/tui/app/input.rs5.5MixedCyclomatic Complexity: jcode_tui::tui::app::input::handle_pre_control_shortcuts (cyclomatic 38)
crates/jcode-app-core/src/server/comm_session.rs5.5MixedCyclomatic Complexity: jcode_app_core::server::comm_session::spawn_swarm_agent (cyclomatic 17)

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

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

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. 80 of 80 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 — 80 dimensions across the health lenses
D1D2D3D4D5D6D7D9D10D12D13D14D15D17D19D20D26D28D29D30D31D34D35D36D43AX10AX3AX4AX6AX8AX9C1C4ED3ES1ES2M1M2M3M4P1P10P2P3P4P5P6P8PF3R1R10R2R3R4R5R6R7R8R9X1X12X13X14X15X16X17X18X19X2X21X22X23X24X25X26X27X28X29X3X30

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, 3927 of 4025 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 · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ 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 01a17ae4-edae-7df6-972e-bd442853d49d.

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 .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 94.3% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, 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 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 215 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 465 test source file(s) (.py, .rs) 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 SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and did not finish re-running within its tier budget — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in sdk/typescript/ (86 tests); node:test via `npm install --ignore-scripts` (no lockfile) in telemetry-worker/ (142 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
  • 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 a Swift Package.swift/Package.resolved, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its SwiftPM dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance — measured, with a gap in what it reached — 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 (55 contributor(s) across 10980 commit(s) sampled, automation and bot accounts excluded). One of them holds 97% of the history; the other 54 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.
  • D44 Platform End-of-Life — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AXR1 Runtime accessibility — 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. Render strategy: boot via DevServer (dev). the dev server did not expose a crawlable HTTP endpoint in time — no runtime 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 Python, Rust, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — 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.
  • 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. 12 further occurrence(s) are not listed individually; the score already reflects all 52.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python, Rust, Swift is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • 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. 43 further occurrence(s) are not listed individually; the score already reflects all 83.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • 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.
  • C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
  • 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".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity3.5 / 10Weak✓ Tool-verified

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

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

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

581 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was jcode_tui::tui::app::remote::server_events::handle_server_event at 366. A further 49 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 jcode_render_core::math::command_symbol at 141 — they are counted neither in the figure above nor in this dimension's score. 23 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/jcode-protocol/src/lib.rs (Request::id at 85), crates/jcode-tui/src/tui/app/input_help.rs (App::command_help at 78), crates/jcode-setup-hints/src/keymap/macos_hotkeys.rs (jcode_setup_hints::keymap::macos_hotkeys::keycode_to_token at 69), crates/jcode-app-core/src/tool/computer/keys.rs (jcode_app_core::tool::computer::keys::ansi_keycode at 49), crates/jcode-app-core/src/tool/computer/mod.rs (jcode_app_core::tool::computer::dispatch at 46), and 18 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.

jcode_tui::tui::app::remote::server_events::handle_server_event (cyclomatic 366) · ×92crates/jcode-tui/src/tui/app/remote/server_events.rs:563
jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 247) · ×60crates/jcode-app-core/src/server/client_lifecycle.rs:351
App::run_turn_interactive (cyclomatic 219) · ×54crates/jcode-tui/src/tui/app/turn.rs:85
jcode_base::session::render::render_messages_and_images_with_compacted_history (cyclomatic 40) · ×41crates/jcode-base/src/session/render.rs:344
jcode::bin::memory_recall_bench::cmd_metrics (cyclomatic 92) · ×34src/bin/memory_recall_bench.rs:1014

+ 178 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 jcode_tui::tui::app::remote::server_events::handle_server_event (cyclomatic 366), Config::apply_env_overrides (cyclomatic 306), jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 247). — 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 3.5 to about 4.1/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

979 method(s) exceeded the cognitive complexity threshold of 15; the worst was App::run_turn_interactive at 763.

jcode_tui::tui::app::remote::server_events::handle_server_event (cognitive 637) · ×173crates/jcode-tui/src/tui/app/remote/server_events.rs:563
jcode_app_core::server::client_lifecycle::handle_client (cognitive 456) · ×106crates/jcode-app-core/src/server/client_lifecycle.rs:351
jcode_base::session::render::render_messages_and_images_with_compacted_history (cognitive 75) · ×75crates/jcode-base/src/session/render.rs:344
App::run_turn_interactive (cognitive 763) · ×66crates/jcode-tui/src/tui/app/turn.rs:85
jcode::bin::memory_recall_bench::cmd_metrics (cognitive 176) · ×58src/bin/memory_recall_bench.rs:1014

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

What to do

  1. Bring the 35 bodies over 120 down to 120 or less in Cognitive Complexity — start with App::run_turn_interactive (cognitive 763), jcode_tui::tui::app::remote::server_events::handle_server_event (cognitive 637), jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cognitive 475). — 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 35 together lifts Cognitive Complexity from 2.0 to about 3.1/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

641 god class(es) detected.

FunctionTooLong: jcode_app_core::server::client_lifecycle::handle_client · ×232crates/jcode-app-core/src/server/client_lifecycle.rs:351
FileTooLong: tui/ui_messages.rs · ×208crates/jcode-tui/src/tui/ui_messages.rs
MethodTooLong: Agent.run_turn_streaming_mpsc · ×115crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:225
ClassTooLong: BridgeState · ×31crates/jcode-harness-api-server/src/translate.rs:118
TooManyMethods: App · ×22crates/jcode-tui/src/tui/app.rs:965

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

What to do

  1. Resolve the 232 FunctionTooLong finding(s) in God Classes — start with lib.rs (14), ui_messages.rs (8), commands.rs (7). — One of this dimension's main actionable groups (232 warning-level).
  2. Resolve the 208 FileTooLong finding(s) in God Classes — start with lib.rs (30), mod.rs (5), commands.rs (2). — One of this dimension's main actionable groups (208 warning-level).
  3. Resolve the 115 MethodTooLong finding(s) in God Classes — start with lib.rs (10), auth.rs (7), mod.rs (6). — One of this dimension's main actionable groups (115 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.2 / 10Stronggated by 1188 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.2 / 10 · rule-coverage 100% · ceiling Verified

1139 duplicated block group(s) detected. A further 49 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 36 of the 1188 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 (7 lines × 2) · ×89crates/jcode-app-core/src/replay.rs:772
Duplicated block (8 lines × 2) · ×86crates/jcode-app-core/src/server/client_api.rs:107
Duplicated block (6 lines × 2) · ×74crates/jcode-app-core/src/channel.rs:630
Duplicated block (10 lines × 2) · ×67crates/jcode-app-core/src/agent/status.rs:155
Duplicated block (9 lines × 2) · ×65crates/jcode-app-core/src/ambient/runner.rs:205

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

What to do

  1. Resolve the 89 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with lib.rs (10), memory_recall_bench.rs (6), color.rs (3). — One of this dimension's main actionable groups (89 warning-level).
  2. Resolve the 86 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with lib.rs (5), debug_swarm_read.rs (4), subscription_api.rs (3). — One of this dimension's main actionable groups (86 warning-level).
  3. Resolve the 74 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with lib.rs (6), telemetry_state.rs (4), openrouter.rs (3). — One of this dimension's main actionable groups (74 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 · Coupling6.1 / 10Adequate✓ 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 6.1 / 10 · rule-coverage 100% · ceiling Prevented

101 production modules (Cargo+npm+SwiftPM+XcodeGen), 0 dependency cycle(s), 7 unstable depended-on module(s). Read from the build's own module declarations; an XcodeGen target's dependency on a local Swift package or on a target of another project is not visible there; 40 module(s) off the main sequence, with abstractness counted on 86 of the 101 (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: jcode-agent-runtime · ×40
Unstable project jcode-app-core
Unstable project jcode-protocol
Unstable project jcode-provider-bedrock
Unstable project jcode-provider-doctor

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

What to do

  1. Resolve the 40 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (40 warning-level).
  2. Resolve the 1 Unstable project jcode-app-core finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project jcode-protocol 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 3 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

3 of 375 classes have LCOM4 above 3.

Low cohesion: MemoryManager (LCOM4 6) · ×3crates/jcode-base/src/memory.rs:184

What to do

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

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

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

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

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

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

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

What to do

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

Detailed fixes: d7_recommendation.md.

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

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

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

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

11528 test methods: 11223 unit, 203 integration, 11 BDD, 91 e2e. The JavaScript/TypeScript suite contributes 215 `it`/`test` case(s) across 20 test file(s) declaring at least one beside 71 .NET test method(s); its tier split is read from package names and paths only. The Rust suite contributes 10877 `#[test]` function(s) across 1060 file(s) declaring at least one; its unit/integration split is Cargo's own — 45 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 365 test function(s) across 35 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 1 serious finding✓ 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

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

Fixed-sleep synchronisation: concurrent configuration is rejected without changing the callback tablesdk/typescript/test/tools.test.ts:159
Skipped (documented): dashboard stays within a five-term SQLite compound SELECT budgettelemetry-worker/test/concurrency.test.mjs:340

What to do

  1. Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with tools.test.ts. — One of this dimension's main actionable groups (1 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.

D12 · Dependency Hygiene8.0 7.9 / 10Strong✓ Tool-verified

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

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

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

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

Outdated: anyhow · ×42

What to do

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

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

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

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

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

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

4 secret(s) detected.

REDACTED

What to do

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

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

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

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

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

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

0 of 824 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. A further 2 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Swift Package.swift/Package.resolved and package.json, and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.4 / 10Strong✓ Tool-verified

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

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

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

Top hotspots: crates/jcode-tui/src/tui/app/remote/server_events.rs (66×366=24156); crates/jcode-app-core/src/server/client_lifecycle.rs (67×247=16549); crates/jcode-base/src/config/env_overrides.rs (35×306=10710) Repeated repair below the complexity floor: crates/jcode-provider-openrouter-runtime/src/lib.rs (23 of 39 changes were fixes); REDACTED (10 of 10 changes were fixes); crates/jcode-tui/src/tui/ui_tests/mod.rs (9 of 17 changes were fixes)

Hotspot: crates/jcode-tui/src/tui/app/remote/server_events.rs · ×145crates/jcode-tui/src/tui/app/remote/server_events.rs:563
Repeated repair: crates/jcode-provider-openrouter-runtime/src/lib.rs · ×35crates/jcode-provider-openrouter-runtime/src/lib.rs:1345

What to do

  1. Resolve the 145 Hotspot finding(s) in Churn × Complexity Hotspots — start with lib.rs (11), mod.rs (3), commands.rs (2). — One of this dimension's main actionable groups (145 warning-level).
  2. Resolve the 35 Repeated repair finding(s) in Churn × Complexity Hotspots — start with lib.rs (7), REDACTED, mod.rs. — One of this dimension's main actionable groups (35 warning-level).

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

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

23 deducted task-comment markers across 679090 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 · ×23crates/jcode-tui-render/src/swarm_gallery.rs:1724

What to do

  1. Resolve the 23 TodoComment finding(s) in Explicit Debt — start with lib.rs (4), ui_messages.rs (3), todo.rs (3). — One of this dimension's main actionable groups (23 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. 122 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

Method: 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

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

✓ On the Gold path — maintain.

Detailed fixes: d20_recommendation.md.

D26 · Project Cohesion9.1 / 10Exemplary✓ 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 9.1 / 10 · rule-coverage 100% · ceiling Documented

4 of 94 build units (Cargo, SwiftPM, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

✓ On the Gold path — maintain.

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

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

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

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

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

125 finding(s): 0 critical, 123 high, 1 medium, 1 low. 111 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 32 file(s) — `crates/jcode-app-core/src/tool/webfetch.rs` (line 216), `crates/jcode-app-core/src/tool/websearch.rs` (line 633), `crates/jcode-base/src/hooks.rs` (line 781, lines 808–809, line 809), `crates/jcode-base/src/platform.rs` (line 17, line 27, line 35, …), `crates/jcode-base/src/process_memory.rs` (line 548, line 574), … (+27 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 7 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

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

What to do

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

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

D30 · Dependency Vulnerabilities7.6 / 10Strong✓ 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 7.6 / 10 · rule-coverage 100% · ceiling Documented

13 finding(s): 0 critical, 0 high, 13 medium, 0 low.

REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d31_recommendation.md.

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

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

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

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

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 1218 of the 1366 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.3 / 10Adequategated by 4 critical findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

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

Strongest change-coupling: comm_requests.rs↔client_lifecycle.rs 100%; client_api.rs↔randomized.rs 100%; markdown_render_full.rs↔markdown_render_lazy.rs 95%

Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py · ×4crates/jcode-app-core/src/tool/discover.rs:1
Change coupling: markdown_render_full.rs ↔ markdown_render_lazy.rs · ×28crates/jcode-tui-markdown/src/markdown_render_full.rs:1
Change-coupling hub: comm_requests.rs → client_lifecycle.rs, client_lightweight_control.rs, comm_control.rs, comm_session.rs, communicate.rs · ×6crates/jcode-app-core/src/protocol_tests/comm_requests.rs

What to do

  1. Resolve the 4 Boundary-crossing change coupling finding(s) in Change Coupling — start with discover.rs, process_title.rs, accessors.rs. — One of this dimension's main actionable groups (4 issue-level).
  2. Resolve the 28 Change coupling finding(s) in Change Coupling — start with REDACTED (3), core_events.rs (2), client_comm_context.rs (2). — One of this dimension's main actionable groups (28 warning-level).
  3. Resolve the 6 Change-coupling hub finding(s) in Change Coupling — start with comm_requests.rs (2), randomized.rs, misc_events.rs. — One of this dimension's main actionable groups (6 warning-level).

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

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

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

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

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

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

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

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

What to do

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

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

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

AX4 · Dependency direction7.5 / 10Strong✓ 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.

  • `jcode-app-core` is a Domain project but references `jcode-harness-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.

What to do

  • Keep dependencies pointing inward: domain/application define interfaces, infrastructure/web implement them (Dependency Inversion).
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.

  • `communicate$module.fetch_awaited_member_reports` 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/jcode-app-core/src/tool/communicate.rs:1532

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.
C1 · Data Protection3.0 / 10Weak✓ Tool-verified

Other · Security — Whether sensitive data is encrypted at rest and in transit and keys are vaulted.

Method: Roslyn plus filesystem scan: encryption presence (EF ColumnEncryption, key-vault references, HTTPS enforcement) and key-derivation KDF detection. Deterministic.

  • No encryption usage (RustCrypto's aes-gcm/chacha20poly1305 encrypting, ring or aws-lc-rs aead sealing, orion, libsodium's secretbox, openssl symm, age, SQLCipher keyed by PRAGMA key, pgcrypto, MongoDB client-side field-level encryption, the OS keyring) was found, and this repository persists personal data in the model cited here — sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore. — telemetry-worker/schema.sql:7

What to do

  • Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Skip if delegated to infra (Postgres TDE, KMS, etc.).
C4 · Data Retention7.5 / 10Strong✓ Tool-verified

Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).

Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.

  • A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept.

What to do

  • Complete the data-lifecycle story: an expiry limit (a declared maximum age for the stored data — a retention-age setting, or a store-level TTL where your storage offers one), a scheduled purge/cleanup job that enforces it, and a documented retention period covering the personal data.
ED3 · Event naming10.0 / 10Exemplary✓ Tool-verified

Other · Event-Driven — Whether persisted/published domain events are named in the past tense (facts that happened) rather than imperatively.

Method: Roslyn scan (event-driven gated): domain and integration events checked for past-tense naming (-ed/-en suffix or irregular set). Naming nudge, low-weight advisory.

  • `UpdateStatus` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name it for the event that occurred (e.g. `ItemAdded`) so the event log records facts. — crates/jcode-base/src/bus.rs:414

What to do

  • Name domain-event cases in the past tense — they record facts that already happened.
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)6.9 / 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 89 of 101 project(s) that lack one — worth up to 1.8 pts.
M2 · Architecture documentation7.0 / 10Strong✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

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

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

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

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.

P2 · Observability7.4 / 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 15/19 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/jcode-harness-api-server`, `crates/jcode-provider-core`, `crates/jcode-sdk`, `packaging/crates-io-placeholder`.

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

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

What to do

  • Codify backups + geo-recovery in IaC (snapshot/replication/geo-redundant) to back the DR plan.
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.

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.

PF3 · Async & latency hygiene7.0 / 10Strong✓ 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.

  • `run` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — crates/jcode-app-core/src/server.rs:2448
  • `run` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — crates/jcode-codemode/src/engine.rs:97

What to do

  • Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
R1 · Type Safety0.0 / 10Critical✓ Tool-verified

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

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

  • 0 typed · 15 plain JS — the untyped files are telemetry-worker/scripts/model-price-report.mjs, telemetry-worker/scripts/move-bulk-events.mjs, telemetry-worker/scripts/run-dashboard.mjs, telemetry-worker/scripts/sync-model-prices.mjs, telemetry-worker/src/concurrency.js, telemetry-worker/src/model-pricing.js (+9 more).

What to do

  • Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
R10 · Code Duplication8.1 / 10Strong✓ Tool-verified

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

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

  • telemetry-worker/src/worker.js:1539 · telemetry-worker/src/worker.js:1753 — the two spans are one implementation copied and then locally edited — 372 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. — telemetry-worker/src/worker.js:1539
  • telemetry-worker/src/worker.js:286 · telemetry-worker/src/worker.js:430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — telemetry-worker/src/worker.js:286
  • telemetry-worker/src/worker.js:421 · telemetry-worker/src/worker.js:469 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:421
  • telemetry-worker/src/worker.js:576 · telemetry-worker/src/worker.js:611 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — telemetry-worker/src/worker.js:576
  • telemetry-worker/src/worker.js:1310 · telemetry-worker/src/worker.js:1326 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1310
  • telemetry-worker/src/worker.js:1460 · telemetry-worker/src/worker.js:1571 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — telemetry-worker/src/worker.js:1460
  • telemetry-worker/src/worker.js:1497 · telemetry-worker/src/worker.js:1758 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — telemetry-worker/src/worker.js:1497
  • telemetry-worker/src/worker.js:1166 · telemetry-worker/src/worker.js:1182 · telemetry-worker/src/worker.js:1198 · telemetry-worker/src/worker.js:1230 — all 4 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. — telemetry-worker/src/worker.js:1166
  • telemetry-worker/src/worker.js:1968 · telemetry-worker/src/worker.js:2004 · telemetry-worker/src/worker.js:2031 — 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. — telemetry-worker/src/worker.js:1968
  • telemetry-worker/src/worker.js:1949 · telemetry-worker/src/worker.js:1975 · telemetry-worker/src/worker.js:2038 — 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. — telemetry-worker/src/worker.js:1949
  • telemetry-worker/src/worker.js:1190 · telemetry-worker/src/worker.js:1206 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1190
  • telemetry-worker/src/worker.js:406 · telemetry-worker/src/worker.js:462 · telemetry-worker/src/worker.js:485 — 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. — telemetry-worker/src/worker.js:406
  • telemetry-worker/src/worker.js:2192 · telemetry-worker/src/worker.js:2227 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:2192

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity5.8 / 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.

  • insertEvent has cyclomatic complexity 135 and cognitive complexity 145; 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. — telemetry-worker/src/worker.js:1143
  • fetch has cyclomatic complexity 61 and cognitive complexity 68; 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. — telemetry-worker/src/worker.js:505
  • insertTurnDetails has cyclomatic complexity 49 and cognitive complexity 46; 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. — telemetry-worker/src/worker.js:1539
  • classifyConcurrency has cyclomatic complexity 40 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/concurrency.js:20
  • normalizeUsageReportEvent has cyclomatic complexity 38 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — telemetry-worker/src/worker.js:2323
  • oauthAccount has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — telemetry-worker/src/oauth-account.js:14
  • insertSessionDetails has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1753
  • normalizeWebEvent has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — telemetry-worker/src/worker.js:2062
  • insertTodoSessionDetails has cyclomatic complexity 28 and cognitive complexity 25; 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. — telemetry-worker/src/worker.js:1975
  • pruneOldEvents has cyclomatic complexity 27 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1015
  • insertWebDetails has cyclomatic complexity 21 and cognitive complexity 18; 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. — telemetry-worker/src/worker.js:2011
  • resolvePriceRows has cyclomatic complexity 20 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/model-pricing.js:160
  • normalizeDiscoveryEvent has cyclomatic complexity 19 and cognitive complexity 21; 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. — telemetry-worker/src/worker.js:2203
  • validateTranscript has cyclomatic complexity 17 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:857
  • (anonymous) has cyclomatic complexity 16 and cognitive complexity 27; 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. — telemetry-worker/scripts/move-bulk-events.mjs:90
  • normalizeInstallFunnelEvent has cyclomatic complexity 16 and cognitive complexity 16; 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. — telemetry-worker/src/worker.js:2147
  • q has cyclomatic complexity 15 and cognitive complexity 24; 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. — telemetry-worker/scripts/move-bulk-events.mjs:32
  • (anonymous) has cyclomatic complexity 15 and cognitive complexity 16; 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. — telemetry-worker/src/worker.js:694
  • writeFirehose has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:369

What to do

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

  • telemetry-worker/src/worker.js has 2307 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — telemetry-worker/src/worker.js:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage6.2 / 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. (×3) — telemetry-worker/scripts/sync-model-prices.mjs:1, telemetry-worker/scripts/move-bulk-events.mjs:1, telemetry-worker/scripts/run-dashboard.mjs:1

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness9.3 / 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 Code10.0 / 10Exemplary✓ Tool-verified

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

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

  • 13 file(s) (~1881 LoC) were excluded from dead-code analysis. This package DOES declare main/module/exports — but every declared target is missing from the scanned tree, which is what a build-output entry (dist/, lib/, out/) looks like before the package is built. Point a declared target at the source entry, or build the package before scanning, so reachability can follow it. — sdk/typescript
R8 · Dependency Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

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

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

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 reader3.5 / 10Weak✓ Tool-verified

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.

  • `entry_count` is read from the bytes being parsed at line 283 (`read_u32`), then used to size a `Vec::with_capacity` at line 284 — and nowhere in its scope is `entry_count` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `entry_count` against the bytes actually remaining and a maximum the format allows before allocating. — crates/jcode-app-core/src/tool/session_search_index.rs:284

What to do

  • Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
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 document2.2 / 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.

  • `print_human` is public and takes `summary: dict[str, Any]` from its caller, and it calls itself at line 1083 (`print_human`) with a piece of `summary` — and nowhere in `print_human` 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 `print_human` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/analyze_runtime_memory_log.py:1083
  • `to_jsonable` is public and takes `value: Any` from its caller, and it calls itself at line 1245 (`to_jsonable`) with a piece of `value` (and at line 1247) — and nowhere in `to_jsonable` 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 `to_jsonable` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/analyze_runtime_memory_log.py:1245
  • `iter_json_values` is public and takes `value: Any` from its caller, and it calls itself at line 36 (`iter_json_values`) with a piece of `value` (and at line 39) — and nowhere in `iter_json_values` 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 `iter_json_values` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/audit_terminal_bench_submission.py:36

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 propagation10.0 / 10Exemplary○ Nothing flagged

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

X28 · Index access outside its own emptiness 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.3 / 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. (×11) — telemetry-worker/src/worker.js:735, telemetry-worker/src/worker.js:848, scripts/bench_headless_memory.py:257, …
  • `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. (×27) — scripts/audit_terminal_bench_submission.py:130, scripts/bench_memory_cli.py:288, scripts/bench_memory_cli.py:296, …
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. — scripts/bench_headless_memory.py:355
  • `except` 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/jcode_monitor.py:79

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.

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 Health47%Adequate — gated by D1, D2, R1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture88%ExemplarySolid.
Maturity81%StrongSolid.
Readiness56%Adequate — gated by D13, P5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security54%Adequate — gated by D29, C1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event-Driven100%ExemplaryStrongest area.
Event Sourcing100%ExemplarySolid.
Performance70%StrongSolid.
Unscored — 3 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 23 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Repo shows no audit-logging mechanism (an audit-log table or model — a struct, Diesel table, SeaORM entity or SQL migration table named for it — a SeaORM ActiveModelBehavior hook or database trigger that records each change, or an event-sourced store beside one) for sensitive changes — absence of evidence is not evidence of a working control. Record an audit trail in code (or document where it lives) so this dimension can be scored.
  • C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
Not included — 50 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's Swift imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No 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 — the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
  • 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; JavaScript, Python, Rust, Swift, TypeScript not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust, Swift, 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. Aggregate roots were found in only one source directory (jcode-base), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .rs, .swift, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.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.
  • D32 Data Compliance (PII/GDPR) — 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.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 178 value object(s); 9 domain event(s); its domain events are published by services or handlers — no domain entity raises one; no aggregate is declared and no domain structure surrounds the state-guarding types: not claimed as DDD
  • 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
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust, Swift source, so there is no service whose uptime a failing dependency could take down
  • P9 Domain vs controller coverage — coverage data present for 36 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not applicable: allocation awareness is rated where code engineers for it — at least 400 production lines that ship benchmarks or already use allocation-aware idioms (8 or more). This repository's Swift code has 3,708 production line(s), 0 such use(s) and no benchmarks, so there is no allocation work to rate. The card is reward-only: its absence costs nothing.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — No web surface: 1066 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

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
  • + 86 more in this group — see findings.md.
D13 · REDACTED Scanning · Leaked secret · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Boundary-crossing change coupling · ×4
  • Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py crates/jcode-app-core/src/tool/discover.rs:1 — `crates/jcode-app-core/src/tool/discover.rs` (context crates) and `scripts/benchmark_discovery.py` (context scripts) sit in DIFFERENT parts of the tree yet change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `bd64f8f8` fix(discovery): enforce provenance report contract; `0c641dfc` fix(discovery): enforce provenance report contract; `977d49c4` Rename discover_tools to integration_tools with search/setup actions — run `git show` on any of them.
  • Boundary-crossing change coupling: process_title.rs ↔ dispatch.rs crates/jcode-base/src/process_title.rs:1 — `crates/jcode-base/src/process_title.rs` (context crates) and `src/cli/dispatch.rs` (context cli) sit in DIFFERENT parts of the tree yet change together 55% of the time (16 of the 29 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `f3d63c0c` fix(windows): clean platform cfgs and selfdev locks; `0696e794` refactor: break process_title->cli by moving initial_title to cli::pr… (at that commit the file was still `src/process_title.rs`); `ba80a32c` Add cloud session CLI bridge (at that commit the file was still `src/process_title.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: accessors.rs ↔ startup.rs crates/jcode-base/src/provider/accessors.rs:1 — `crates/jcode-base/src/provider/accessors.rs` (context crates) and `src/cli/startup.rs` (context cli) sit in DIFFERENT parts of the tree yet change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `3e4f0933` refactor(providers): remove the Claude Code CLI subprocess transport; `3d187f4a` refactor(provider): move OpenRouter runtime out of jcode-base into do…; `a8faf98f` refactor(provider): move Anthropic runtime out of jcode-base (base wi… — run `git show` on any of them.
  • Boundary-crossing change coupling: misc_events.rs ↔ acp.rs crates/jcode-app-core/src/protocol_tests/misc_events.rs:1 — `crates/jcode-app-core/src/protocol_tests/misc_events.rs` (context crates) and `src/cli/acp.rs` (context cli) sit in DIFFERENT parts of the tree yet 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `753f0d10` feat(router): server-side account failover for Desktop/SDK clients; `1e2c6de9` feat(server): opt in to disconnected remote turn continuation; `5b63e5f6` feat(server): opt in to disconnected remote turn continuation — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AX4 · Dependency direction · Dependency-rule violation · ×1
  • Dependency-rule violation: jcode-app-core (Domain) → jcode-harness-api (Web) — `jcode-app-core` is a Domain project but references `jcode-harness-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: communicate$module.fetch_awaited_member_reports crates/jcode-app-core/src/tool/communicate.rs:1532 — `communicate$module.fetch_awaited_member_reports` 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.
D28 · Secrets (history) · 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
Serious — 3752 finding(s)
D3 · God Classes · FunctionTooLong · ×232
  • FunctionTooLong: jcode_app_core::server::client_lifecycle::handle_client crates/jcode-app-core/src/server/client_lifecycle.rs:351 — FunctionTooLong — jcode_app_core::server::client_lifecycle::handle_client runs 2256 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 2156 over it, 22.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.
  • FunctionTooLong: jcode_tui::tui::app::remote::server_events::handle_server_event crates/jcode-tui/src/tui/app/remote/server_events.rs:563 — FunctionTooLong — jcode_tui::tui::app::remote::server_events::handle_server_event runs 2088 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 1988 over it, 20.88× 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: jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input crates/jcode-tui/src/tui/app/remote/key_handling.rs:1067 — FunctionTooLong — jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input runs 1260 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 1160 over it, 12.60× 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: jcode::bin::memory_recall_bench::cmd_metrics src/bin/memory_recall_bench.rs:1014 — FunctionTooLong — jcode::bin::memory_recall_bench::cmd_metrics runs 815 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 715 over it, 8.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: jcode_tui_markdown::markdown_render_full::render_markdown_with_width crates/jcode-tui-markdown/src/markdown_render_full.rs:20 — FunctionTooLong — jcode_tui_markdown::markdown_render_full::render_markdown_with_width runs 754 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 654 over it, 7.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.
  • FunctionTooLong: jcode_tui::tui::ui_viewport::draw_messages crates/jcode-tui/src/tui/ui_viewport.rs:399 — FunctionTooLong — jcode_tui::tui::ui_viewport::draw_messages runs 736 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 636 over it, 7.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy crates/jcode-tui-markdown/src/markdown_render_lazy.rs:3 — FunctionTooLong — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy runs 700 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 600 over it, 7.00× 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: jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request crates/jcode-app-core/src/server/client_lightweight_control.rs:246 — FunctionTooLong — jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request runs 688 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 588 over it, 6.88× 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: jcode_tui::tui::ui::draw_inner crates/jcode-tui/src/tui/ui.rs:2648 — FunctionTooLong — jcode_tui::tui::ui::draw_inner runs 684 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 584 over it, 6.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: jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command crates/jcode-app-core/src/server/debug_swarm_read.rs:21 — FunctionTooLong — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command runs 645 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 545 over it, 6.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:867 — FunctionTooLong — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked runs 582 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 482 over it, 5.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::ui_tools::get_tool_summary_with_budget crates/jcode-tui/src/tui/ui_tools.rs:888 — FunctionTooLong — jcode_tui::tui::ui_tools::get_tool_summary_with_budget 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.
  • FunctionTooLong: jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal crates/jcode-tui/src/tui/app/remote/key_handling.rs:229 — FunctionTooLong — jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal runs 538 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 438 over it, 5.38× 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: jcode_app_core::server::client_session::handle_resume_session crates/jcode-app-core/src/server/client_session.rs:1390 — FunctionTooLong — jcode_app_core::server::client_session::handle_resume_session runs 535 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 435 over it, 5.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_provider_cursor_runtime::agent_transport::run_agent_turn crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — FunctionTooLong — jcode_provider_cursor_runtime::agent_transport::run_agent_turn runs 523 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 423 over it, 5.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::ui_messages::render_tool_message crates/jcode-tui/src/tui/ui_messages.rs:4657 — FunctionTooLong — jcode_tui::tui::ui_messages::render_tool_message runs 478 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 378 over it, 4.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode::cli::dispatch::run_main src/cli/dispatch.rs:74 — FunctionTooLong — jcode::cli::dispatch::run_main runs 457 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 357 over it, 4.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.
  • FunctionTooLong: jcode::bin::tui_bench::main src/bin/tui_bench.rs:1212 — FunctionTooLong — jcode::bin::tui_bench::main runs 452 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 352 over it, 4.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: jcode_tui::tui::app::state_ui::format_cache_stats crates/jcode-tui/src/tui/app/state_ui.rs:1224 — FunctionTooLong — jcode_tui::tui::app::state_ui::format_cache_stats runs 440 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 340 over it, 4.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.
  • FunctionTooLong: jcode_render_core::markdown::parse_markdown crates/jcode-render-core/src/markdown.rs:141 — FunctionTooLong — jcode_render_core::markdown::parse_markdown runs 424 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 324 over it, 4.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_app_core::server::comm_control::handle_comm_task_control crates/jcode-app-core/src/server/comm_control.rs:1745 — FunctionTooLong — jcode_app_core::server::comm_control::handle_comm_task_control runs 407 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 307 over it, 4.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::ui_overlays::draw_help_overlay crates/jcode-tui/src/tui/ui_overlays.rs:223 — FunctionTooLong — jcode_tui::tui::ui_overlays::draw_help_overlay runs 400 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 300 over it, 4.00× 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: jcode_app_core::server::debug_command_exec::execute_debug_command crates/jcode-app-core/src/server/debug_command_exec.rs:162 — FunctionTooLong — jcode_app_core::server::debug_command_exec::execute_debug_command runs 396 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 296 over it, 3.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::ui_inline_interactive::draw_inline_interactive crates/jcode-tui/src/tui/ui_inline_interactive.rs:564 — FunctionTooLong — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive runs 382 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 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1740 — FunctionTooLong — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated runs 365 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 265 over it, 3.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 207 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×208
  • FileTooLong: tui/ui_messages.rs crates/jcode-tui/src/tui/ui_messages.rs — FileTooLong — 3871 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 114 free functions. The bar is 500 significant lines; this is 3371 over it, 7.74× 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: server/client_lifecycle.rs crates/jcode-app-core/src/server/client_lifecycle.rs — FileTooLong — 3045 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 2545 over it, 6.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: app/inline_interactive.rs crates/jcode-tui/src/tui/app/inline_interactive.rs — FileTooLong — 2948 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: App (632-4204). The bar is 500 significant lines; this is 2448 over it, 5.90× 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: cli/commands.rs src/cli/commands.rs — FileTooLong — 2854 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 2354 over it, 5.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: app/input.rs crates/jcode-tui/src/tui/app/input.rs — FileTooLong — 2711 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 2211 over it, 5.42× 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: app/commands.rs crates/jcode-tui/src/tui/app/commands.rs — FileTooLong — 2607 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 127 free functions. The bar is 500 significant lines; this is 2107 over it, 5.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/translate.rs crates/jcode-harness-api-server/src/translate.rs — FileTooLong — 2469 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: BridgeState (3 blocks, 118-3612). The bar is 500 significant lines; this is 1969 over it, 4.94× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: app/auth.rs crates/jcode-tui/src/tui/app/auth.rs — FileTooLong — 2459 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: App (85-3398). The bar is 500 significant lines; this is 1959 over it, 4.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: remote/server_events.rs crates/jcode-tui/src/tui/app/remote/server_events.rs — FileTooLong — 2338 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 1838 over it, 4.68× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: provider/mod.rs crates/jcode-base/src/provider/mod.rs — FileTooLong — 2135 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: MultiProvider (4 blocks, 384-3067). The bar is 500 significant lines; this is 1635 over it, 4.27× 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: tui/ui.rs crates/jcode-tui/src/tui/ui.rs — FileTooLong — 2074 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 91 free functions. The bar is 500 significant lines; this is 1574 over it, 4.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: cli/cloud_move.rs src/cli/cloud_move.rs — FileTooLong — 2059 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 64 free functions. The bar is 500 significant lines; this is 1559 over it, 4.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs crates/jcode-telemetry-core/src/lib.rs — FileTooLong — 2049 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 87 free functions. The bar is 500 significant lines; this is 1549 over it, 4.10× 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: tool/communicate.rs crates/jcode-app-core/src/tool/communicate.rs — FileTooLong — 2032 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 1532 over it, 4.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: session_picker/loading.rs crates/jcode-tui/src/tui/session_picker/loading.rs — FileTooLong — 1980 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 73 free functions. The bar is 500 significant lines; this is 1480 over it, 3.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: remote/key_handling.rs crates/jcode-tui/src/tui/app/remote/key_handling.rs — FileTooLong — 1968 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 1468 over it, 3.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: server/comm_control.rs crates/jcode-app-core/src/server/comm_control.rs — FileTooLong — 1920 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 39 free functions. The bar is 500 significant lines; this is 1420 over it, 3.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: bin/memory_recall_bench.rs src/bin/memory_recall_bench.rs — FileTooLong — 1890 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 33 free functions. The bar is 500 significant lines; this is 1390 over it, 3.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: tui/ui_prepare.rs crates/jcode-tui/src/tui/ui_prepare.rs — FileTooLong — 1828 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 48 free functions. The bar is 500 significant lines; this is 1328 over it, 3.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs crates/jcode-provider-openrouter-runtime/src/lib.rs — FileTooLong — 1818 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: OpenRouterProvider (2 blocks, 825-2843). The bar is 500 significant lines; this is 1318 over it, 3.64× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: tui/ui_input.rs crates/jcode-tui/src/tui/ui_input.rs — FileTooLong — 1814 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 70 free functions. The bar is 500 significant lines; this is 1314 over it, 3.63× 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/jcode-tui/src/tui/app.rs — FileTooLong — 1797 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: App (2 blocks, 965-2957). The bar is 500 significant lines; this is 1297 over it, 3.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/server.rs crates/jcode-app-core/src/server.rs — FileTooLong — 1790 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 71% of them inside a single declaration: Server (2 blocks, 752-2629). The bar is 500 significant lines; this is 1290 over it, 3.58× 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: tui/session_picker.rs crates/jcode-tui/src/tui/session_picker.rs — FileTooLong — 1758 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 90% of them inside a single declaration: SessionPicker (2 blocks, 278-2655). The bar is 500 significant lines; this is 1258 over it, 3.52× 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/worker.js telemetry-worker/src/worker.js — FileTooLong — 1746 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 1246 over it, 3.49× 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.
  • + 183 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_tui · ×173
  • jcode_tui::tui::app::remote::server_events::handle_server_event (cognitive 637) crates/jcode-tui/src/tui/app/remote/server_events.rs:563 — jcode_tui::tui::app::remote::server_events::handle_server_event has cognitive complexity 637 (threshold 15). Drivers by points: if/else 246 (533 pts), boolean chains 73, match/switch 10 (26 pts), loops 2 (5 pts) (nesting depth added 306). 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.
  • jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cognitive 475) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1067 — jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input has cognitive complexity 475 (threshold 15). Drivers by points: if/else 185 (398 pts), match/switch 15 (50 pts), boolean chains 27 (nesting depth added 248). 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.
  • jcode_tui::tui::ui_viewport::draw_messages (cognitive 314) crates/jcode-tui/src/tui/ui_viewport.rs:399 — jcode_tui::tui::ui_viewport::draw_messages has cognitive complexity 314 (threshold 15). Drivers by points: if/else 118 (249 pts), loops 15 (27 pts), boolean chains 26, match/switch 3 (12 pts) (nesting depth added 152). 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.
  • jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal (cognitive 220) crates/jcode-tui/src/tui/app/remote/key_handling.rs:229 — jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal has cognitive complexity 220 (threshold 15). Drivers by points: if/else 119 (176 pts), match/switch 11 (27 pts), boolean chains 17 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_messages::render_tool_message (cognitive 199) crates/jcode-tui/src/tui/ui_messages.rs:4657 — jcode_tui::tui::ui_messages::render_tool_message has cognitive complexity 199 (threshold 15). Drivers by points: if/else 73 (123 pts), loops 14 (45 pts), boolean chains 29, match/switch 1 (2 pts) (nesting depth added 82). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_inline_interactive::draw_inline_interactive (cognitive 172) crates/jcode-tui/src/tui/ui_inline_interactive.rs:564 — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive has cognitive complexity 172 (threshold 15). Drivers by points: if/else 91 (139 pts), boolean chains 21, loops 4 (9 pts), match/switch 2 (3 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui::draw_inner (cognitive 166) crates/jcode-tui/src/tui/ui.rs:2648 — jcode_tui::tui::ui::draw_inner has cognitive complexity 166 (threshold 15). Drivers by points: if/else 93 (130 pts), boolean chains 24, loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_prepare::render_message_into (cognitive 101) crates/jcode-tui/src/tui/ui_prepare.rs:1327 — jcode_tui::tui::ui_prepare::render_message_into has cognitive complexity 101 (threshold 15). Drivers by points: if/else 27 (50 pts), loops 18 (43 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::video_export::buffer_to_svg (cognitive 98) crates/jcode-tui/src/video_export.rs:612 — jcode_tui::video_export::buffer_to_svg has cognitive complexity 98 (threshold 15). Drivers by points: if/else 23 (69 pts), loops 9 (20 pts), boolean chains 9 (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.
  • jcode_tui::tui::app::commands::handle_session_command (cognitive 97) crates/jcode-tui/src/tui/app/commands.rs:1676 — jcode_tui::tui::app::commands::handle_session_command has cognitive complexity 97 (threshold 15). Drivers by points: if/else 56 (70 pts), boolean chains 10, match/switch 5 (10 pts), loops 3 (7 pts) (nesting depth added 23). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • jcode_tui::tui::app::remote::process_remote_followups (cognitive 93) crates/jcode-tui/src/tui/app/remote.rs:1373 — jcode_tui::tui::app::remote::process_remote_followups has cognitive complexity 93 (threshold 15). Drivers by points: if/else 42 (68 pts), boolean chains 18, loops 2 (4 pts), match/switch 1 (3 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.
  • jcode_tui::tui::app::remote::handle_tick (cognitive 90) crates/jcode-tui/src/tui/app/remote.rs:91 — jcode_tui::tui::app::remote::handle_tick has cognitive complexity 90 (threshold 15). Drivers by points: if/else 34 (58 pts), match/switch 6 (15 pts), boolean chains 12, loops 3 (5 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::info_widget_layout::calculate_placements_anchored (cognitive 88) crates/jcode-tui/src/tui/info_widget_layout.rs:125 — jcode_tui::tui::info_widget_layout::calculate_placements_anchored has cognitive complexity 88 (threshold 15). Drivers by points: if/else 30 (56 pts), boolean chains 16, match/switch 5 (9 pts), loops 5 (7 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.
  • jcode_tui::tui::app::state_ui::handle_info_command (cognitive 87) crates/jcode-tui/src/tui/app/state_ui.rs:1894 — jcode_tui::tui::app::state_ui::handle_info_command has cognitive complexity 87 (threshold 15). Drivers by points: if/else 39 (71 pts), match/switch 4 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_tools::get_tool_summary_with_budget (cognitive 84) crates/jcode-tui/src/tui/ui_tools.rs:888 — jcode_tui::tui::ui_tools::get_tool_summary_with_budget has cognitive complexity 84 (threshold 15). Drivers by points: if/else 31 (53 pts), match/switch 16 (31 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.
  • jcode_tui::tui::app::remote::reconnect::connect_with_retry (cognitive 71) crates/jcode-tui/src/tui/app/remote/reconnect.rs:476 — jcode_tui::tui::app::remote::reconnect::connect_with_retry has cognitive complexity 71 (threshold 15). Drivers by points: if/else 17 (43 pts), match/switch 5 (14 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_input::draw_status (cognitive 70) crates/jcode-tui/src/tui/ui_input.rs:819 — jcode_tui::tui::ui_input::draw_status has cognitive complexity 70 (threshold 15). Drivers by points: if/else 36 (61 pts), match/switch 2 (5 pts), loops 1 (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.
  • jcode_tui::tui::ui_input::build_notification_spans (cognitive 66) crates/jcode-tui/src/tui/ui_input.rs:1753 — jcode_tui::tui::ui_input::build_notification_spans has cognitive complexity 66 (threshold 15). Drivers by points: if/else 39 (65 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::commands_cloud::finish_cloud_command (cognitive 62) crates/jcode-tui/src/tui/app/commands_cloud.rs:819 — jcode_tui::tui::app::commands_cloud::finish_cloud_command has cognitive complexity 62 (threshold 15). Drivers by points: if/else 27 (46 pts), match/switch 5 (13 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command (cognitive 59) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:518 — jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (37 pts), match/switch 7 (18 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.
  • jcode_tui::tui::ui_messages::render_background_task_message (cognitive 59) crates/jcode-tui/src/tui/ui_messages.rs:3190 — jcode_tui::tui::ui_messages::render_background_task_message has cognitive complexity 59 (threshold 15). Drivers by points: if/else 35 (50 pts), loops 3 (7 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.
  • jcode_tui::tui::info_widget_stability::analyze_frames_with_scroll (cognitive 55) crates/jcode-tui/src/tui/info_widget_stability.rs:183 — jcode_tui::tui::info_widget_stability::analyze_frames_with_scroll has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 10 (18 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_header::build_persistent_header_with_auth (cognitive 55) crates/jcode-tui/src/tui/ui_header.rs:563 — jcode_tui::tui::ui_header::build_persistent_header_with_auth has cognitive complexity 55 (threshold 15). Drivers by points: if/else 35 (48 pts), boolean chains 5, match/switch 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.
  • jcode_tui::tui::info_widget::render_ambient_widget (cognitive 54) crates/jcode-tui/src/tui/info_widget.rs:2043 — jcode_tui::tui::info_widget::render_ambient_widget has cognitive complexity 54 (threshold 15). Drivers by points: if/else 32 (47 pts), boolean chains 6, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_inline_interactive::model_suggestion_lines (cognitive 54) crates/jcode-tui/src/tui/ui_inline_interactive.rs:426 — jcode_tui::tui::ui_inline_interactive::model_suggestion_lines has cognitive complexity 54 (threshold 15). Drivers by points: if/else 27 (45 pts), boolean chains 7, loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 148 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×145
  • Hotspot: crates/jcode-tui/src/tui/app/remote/server_events.rs crates/jcode-tui/src/tui/app/remote/server_events.rs:563 — crates/jcode-tui/src/tui/app/remote/server_events.rs changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 366 in jcode_tui::tui::app::remote::server_events::handle_server_event at line 563. 32 of those changes were fix/bug commits, and the other 34 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote/server_events.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/jcode-app-core/src/server/client_lifecycle.rs crates/jcode-app-core/src/server/client_lifecycle.rs:351 — crates/jcode-app-core/src/server/client_lifecycle.rs changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 247 in jcode_app_core::server::client_lifecycle::handle_client at line 351. 23 of those changes were fix/bug commits, and the other 44 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/server/client_lifecycle.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/jcode-base/src/config/env_overrides.rs crates/jcode-base/src/config/env_overrides.rs:9 — crates/jcode-base/src/config/env_overrides.rs changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 306 in Config::apply_env_overrides at line 9. 3 of those changes were fix/bug commits, and the other 32 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/config/env_overrides.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/jcode-harness-api-server/src/translate.rs crates/jcode-harness-api-server/src/translate.rs:1541 — crates/jcode-harness-api-server/src/translate.rs changed 77 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 137 in BridgeState::legacy_event_to_api at line 1541. 22 of those changes were fix/bug commits, and the other 55 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-harness-api-server/src/translate.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/jcode-tui/src/tui/app/remote/key_handling.rs crates/jcode-tui/src/tui/app/remote/key_handling.rs:1067 — crates/jcode-tui/src/tui/app/remote/key_handling.rs changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 219 in jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input at line 1067. 15 of those changes were fix/bug commits, and the other 33 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote/key_handling.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/jcode-tui/src/tui/ui_messages.rs crates/jcode-tui/src/tui/ui_messages.rs:4657 — crates/jcode-tui/src/tui/ui_messages.rs changed 89 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 102 in jcode_tui::tui::ui_messages::render_tool_message at line 4657. 21 of those changes were fix/bug commits, and the other 68 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/ui_messages.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/jcode-app-core/src/agent/turn_streaming_mpsc.rs crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:225 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 181 in Agent::run_turn_streaming_mpsc at line 225. 21 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/agent/turn_streaming_mpsc.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/jcode-tui/src/tui/ui.rs crates/jcode-tui/src/tui/ui.rs:2648 — crates/jcode-tui/src/tui/ui.rs changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in jcode_tui::tui::ui::draw_inner at line 2648. 18 of those changes were fix/bug commits, and the other 37 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/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.
  • Hotspot: crates/jcode-app-core/src/agent/turn_loops.rs crates/jcode-app-core/src/agent/turn_loops.rs:56 — crates/jcode-app-core/src/agent/turn_loops.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 160 in Agent::run_turn at line 56. 10 of those changes were fix/bug commits, and the other 23 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/agent/turn_loops.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/jcode-tui/src/tui/ui_viewport.rs crates/jcode-tui/src/tui/ui_viewport.rs:399 — crates/jcode-tui/src/tui/ui_viewport.rs changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in jcode_tui::tui::ui_viewport::draw_messages at line 399. 13 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/ui_viewport.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/jcode-tui/src/tui/app/navigation.rs crates/jcode-tui/src/tui/app/navigation.rs:1366 — crates/jcode-tui/src/tui/app/navigation.rs changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in App::handle_mouse_event at line 1366. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/navigation.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/jcode-tui/src/tui/app/turn.rs crates/jcode-tui/src/tui/app/turn.rs:85 — crates/jcode-tui/src/tui/app/turn.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 219 in App::run_turn_interactive at line 85. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/turn.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/jcode-app-core/src/tool/communicate.rs crates/jcode-app-core/src/tool/communicate.rs:2017 — crates/jcode-app-core/src/tool/communicate.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 122 in CommunicateTool::execute at line 2017. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/tool/communicate.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/jcode-tui/src/tui/app/remote.rs crates/jcode-tui/src/tui/app/remote.rs:1373 — crates/jcode-tui/src/tui/app/remote.rs changed 56 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in jcode_tui::tui::app::remote::process_remote_followups at line 1373. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote.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/jcode-tui/src/tui/app/input.rs crates/jcode-tui/src/tui/app/input.rs:2459 — crates/jcode-tui/src/tui/app/input.rs changed 87 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in jcode_tui::tui::app::input::handle_pre_control_shortcuts at line 2459. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/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.
  • Hotspot: crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:536 — crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in App::get_suggestions_for at line 536. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/state_ui_input_helpers.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/jcode-tui/src/tui/app/inline_interactive.rs crates/jcode-tui/src/tui/app/inline_interactive.rs:3511 — crates/jcode-tui/src/tui/app/inline_interactive.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in App::handle_inline_interactive_key at line 3511. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/inline_interactive.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/jcode-protocol/src/lib.rs crates/jcode-protocol/src/lib.rs:796 — crates/jcode-protocol/src/lib.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in Request::id at line 796. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-protocol/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/jcode-tui/src/tui/app/commands.rs crates/jcode-tui/src/tui/app/commands.rs:1676 — crates/jcode-tui/src/tui/app/commands.rs changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in jcode_tui::tui::app::commands::handle_session_command at line 1676. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/commands.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/jcode-tui/src/tui/app/tui_state.rs crates/jcode-tui/src/tui/app/tui_state.rs:1557 — crates/jcode-tui/src/tui/app/tui_state.rs changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in App::info_widget_data at line 1557. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/tui_state.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: src/cli/dispatch.rs src/cli/dispatch.rs:74 — src/cli/dispatch.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in jcode::cli::dispatch::run_main at line 74. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- src/cli/dispatch.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/jcode-tui/src/tui/app/debug_cmds.rs crates/jcode-tui/src/tui/app/debug_cmds.rs:93 — crates/jcode-tui/src/tui/app/debug_cmds.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 175 in App::handle_debug_command at line 93. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/debug_cmds.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: telemetry-worker/src/worker.js telemetry-worker/src/worker.js:1143 — telemetry-worker/src/worker.js changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in worker.insertEvent at line 1143. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- telemetry-worker/src/worker.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:867 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 83 in jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked at line 867. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-openai-runtime/src/openai_stream_runtime.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/jcode-app-core/src/server.rs crates/jcode-app-core/src/server.rs:1338 — crates/jcode-app-core/src/server.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in Server::spawn_background_tasks at line 1338. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/server.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.
  • + 120 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×115
  • MethodTooLong: Agent.run_turn_streaming_mpsc crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:225 — MethodTooLong — run_turn_streaming_mpsc runs 1255 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 1155 over it, 12.55× 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: App.run_turn_interactive crates/jcode-tui/src/tui/app/turn.rs:85 — MethodTooLong — run_turn_interactive runs 1121 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 1021 over it, 11.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Agent.run_turn crates/jcode-app-core/src/agent/turn_loops.rs:56 — MethodTooLong — run_turn runs 914 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 814 over it, 9.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: App.handle_debug_command crates/jcode-tui/src/tui/app/debug_cmds.rs:93 — MethodTooLong — handle_debug_command runs 872 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 772 over it, 8.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: CommunicateTool.execute crates/jcode-app-core/src/tool/communicate.rs:2017 — MethodTooLong — execute runs 776 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 676 over it, 7.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.
  • MethodTooLong: BridgeState.legacy_event_to_api crates/jcode-harness-api-server/src/translate.rs:1541 — MethodTooLong — legacy_event_to_api runs 760 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 660 over it, 7.60× 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: BridgeState.translate_request crates/jcode-harness-api-server/src/translate.rs:382 — MethodTooLong — translate_request runs 688 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 588 over it, 6.88× 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: Config.apply_env_overrides crates/jcode-base/src/config/env_overrides.rs:9 — MethodTooLong — apply_env_overrides runs 584 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 484 over it, 5.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: App.handle_login_input crates/jcode-tui/src/tui/app/auth.rs:1841 — MethodTooLong — handle_login_input runs 559 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 459 over it, 5.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: OpenAIProvider.complete crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:185 — MethodTooLong — complete runs 481 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 381 over it, 4.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.new crates/jcode-tui/src/tui/app/tui_lifecycle.rs:769 — MethodTooLong — new runs 469 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 369 over it, 4.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.new_minimal_with_session crates/jcode-tui/src/tui/app/tui_lifecycle.rs:300 — MethodTooLong — new_minimal_with_session runs 449 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 349 over it, 4.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.get_suggestions_for crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:536 — MethodTooLong — get_suggestions_for runs 442 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 342 over it, 4.42× 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: GmailTool.execute crates/jcode-app-core/src/tool/gmail.rs:155 — MethodTooLong — execute runs 440 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 340 over it, 4.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: Server.spawn_background_tasks crates/jcode-app-core/src/server.rs:1338 — MethodTooLong — spawn_background_tasks runs 435 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 335 over it, 4.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.handle_inline_interactive_key crates/jcode-tui/src/tui/app/inline_interactive.rs:3511 — MethodTooLong — handle_inline_interactive_key runs 417 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 317 over it, 4.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DiscoverToolsTool.execute crates/jcode-app-core/src/tool/discover.rs:527 — MethodTooLong — execute runs 382 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 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.build_model_picker_entries crates/jcode-tui/src/tui/app/inline_interactive.rs:1716 — MethodTooLong — build_model_picker_entries runs 356 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 256 over it, 3.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: Config.display_string crates/jcode-base/src/config/display_summary.rs:4 — MethodTooLong — display_string runs 342 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 242 over it, 3.42× 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: App.debug_app_owned_memory_profile crates/jcode-tui/src/tui/app/debug_profile.rs:175 — MethodTooLong — debug_app_owned_memory_profile runs 322 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 222 over it, 3.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SessionPicker.build_preview_cache crates/jcode-tui/src/tui/session_picker.rs:1674 — MethodTooLong — build_preview_cache runs 314 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 214 over it, 3.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: App.handle_mouse_event crates/jcode-tui/src/tui/app/navigation.rs:1366 — MethodTooLong — handle_mouse_event runs 294 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 194 over it, 2.94× 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: App.info_widget_data crates/jcode-tui/src/tui/app/tui_state.rs:1557 — MethodTooLong — info_widget_data runs 284 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 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BgTool.execute crates/jcode-app-core/src/tool/bg.rs:516 — MethodTooLong — execute runs 281 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 181 over it, 2.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Server.monitor_bus crates/jcode-app-core/src/server.rs:2078 — MethodTooLong — monitor_bus runs 268 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 168 over it, 2.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.
  • + 90 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_app_core · ×106
  • jcode_app_core::server::client_lifecycle::handle_client (cognitive 456) crates/jcode-app-core/src/server/client_lifecycle.rs:351 — jcode_app_core::server::client_lifecycle::handle_client has cognitive complexity 456 (threshold 15). Drivers by points: if/else 125 (371 pts), match/switch 21 (57 pts), loops 8 (17 pts), boolean chains 11 (nesting depth added 291). 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.
  • jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command (cognitive 176) crates/jcode-app-core/src/server/debug_swarm_read.rs:21 — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command has cognitive complexity 176 (threshold 15). Drivers by points: if/else 64 (119 pts), loops 21 (55 pts), boolean chains 2 (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command (cognitive 131) crates/jcode-app-core/src/server/debug_swarm_write.rs:19 — jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command has cognitive complexity 131 (threshold 15). Drivers by points: if/else 48 (110 pts), loops 5 (16 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 75). 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.
  • jcode_app_core::server::debug_command_exec::execute_debug_command (cognitive 104) crates/jcode-app-core/src/server/debug_command_exec.rs:162 — jcode_app_core::server::debug_command_exec::execute_debug_command has cognitive complexity 104 (threshold 15). Drivers by points: if/else 65 (89 pts), match/switch 4 (7 pts), boolean chains 4, loops 2 (4 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.
  • jcode_app_core::server::client_comm_message::handle_comm_message (cognitive 89) crates/jcode-app-core/src/server/client_comm_message.rs:103 — jcode_app_core::server::client_comm_message::handle_comm_message has cognitive complexity 89 (threshold 15). Drivers by points: if/else 29 (58 pts), match/switch 7 (23 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::client_session::handle_resume_session (cognitive 89) crates/jcode-app-core/src/server/client_session.rs:1390 — jcode_app_core::server::client_session::handle_resume_session has cognitive complexity 89 (threshold 15). Drivers by points: if/else 33 (73 pts), boolean chains 10, loops 2 (4 pts), match/switch 2 (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_app_core::server::debug::handle_debug_client (cognitive 86) crates/jcode-app-core/src/server/debug.rs:253 — jcode_app_core::server::debug::handle_debug_client has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (42 pts), match/switch 9 (31 pts), loops 3 (11 pts), boolean chains 2 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::tool::browser_fast::run (cognitive 85) crates/jcode-app-core/src/tool/browser_fast.rs:583 — jcode_app_core::tool::browser_fast::run has cognitive complexity 85 (threshold 15). Drivers by points: if/else 37 (66 pts), boolean chains 15, match/switch 2 (3 pts), loops 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.
  • jcode_app_core::tool::apply_patch::parse_apply_patch (cognitive 83) crates/jcode-app-core/src/tool/apply_patch.rs:661 — jcode_app_core::tool::apply_patch::parse_apply_patch has cognitive complexity 83 (threshold 15). Drivers by points: if/else 24 (67 pts), loops 4 (11 pts), boolean chains 5 (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.
  • jcode_app_core::server::comm_control::handle_comm_task_control (cognitive 79) crates/jcode-app-core/src/server/comm_control.rs:1745 — jcode_app_core::server::comm_control::handle_comm_task_control has cognitive complexity 79 (threshold 15). Drivers by points: if/else 35 (67 pts), boolean chains 6, match/switch 4 (6 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.
  • jcode_app_core::server::runtime_commands::execute (cognitive 79) crates/jcode-app-core/src/server/runtime_commands.rs:34 — jcode_app_core::server::runtime_commands::execute has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (56 pts), match/switch 12 (22 pts), boolean chains 1 (nesting depth added 40). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_app_core::tool::browser_fast_actions::candidates (cognitive 74) crates/jcode-app-core/src/tool/browser_fast_actions.rs:158 — jcode_app_core::tool::browser_fast_actions::candidates has cognitive complexity 74 (threshold 15). Drivers by points: if/else 19 (48 pts), loops 6 (16 pts), boolean chains 10 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::group_transfer::handle_with_gate (cognitive 70) crates/jcode-app-core/src/server/group_transfer.rs:248 — jcode_app_core::server::group_transfer::handle_with_gate has cognitive complexity 70 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 12 (31 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::client_session::handle_subscribe (cognitive 68) crates/jcode-app-core/src/server/client_session.rs:562 — jcode_app_core::server::client_session::handle_subscribe has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27 (64 pts), boolean chains 2, match/switch 1 (2 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.
  • jcode_app_core::tool::batch::normalize_batch_input (cognitive 62) crates/jcode-app-core/src/tool/batch.rs:111 — jcode_app_core::tool::batch::normalize_batch_input has cognitive complexity 62 (threshold 15). Drivers by points: if/else 11 (46 pts), loops 3 (12 pts), boolean chains 4 (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.
  • jcode_app_core::tool::communicate::run_swarm_plan_loop (cognitive 62) crates/jcode-app-core/src/tool/communicate.rs:1137 — jcode_app_core::tool::communicate::run_swarm_plan_loop has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (45 pts), match/switch 3 (12 pts), loops 2 (3 pts), boolean chains 2 (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.
  • jcode_app_core::replay::export_timeline (cognitive 56) crates/jcode-app-core/src/replay.rs:138 — jcode_app_core::replay::export_timeline has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 6 (12 pts), match/switch 2 (4 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.
  • jcode_app_core::tool::selfdev::status::selfdev_status_output (cognitive 56) crates/jcode-app-core/src/tool/selfdev/status.rs:3 — jcode_app_core::tool::selfdev::status::selfdev_status_output has cognitive complexity 56 (threshold 15). Drivers by points: if/else 33 (47 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::tool::browser_request::bridge_request (cognitive 55) crates/jcode-app-core/src/tool/browser_request.rs:3 — jcode_app_core::tool::browser_request::bridge_request has cognitive complexity 55 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 5, match/switch 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.
  • jcode_app_core::tool::todo::normalize_todo_input (cognitive 54) crates/jcode-app-core/src/tool/todo.rs:1060 — jcode_app_core::tool::todo::normalize_todo_input has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::swarm::update_member_status_with_report_tldr (cognitive 49) crates/jcode-app-core/src/server/swarm.rs:1654 — jcode_app_core::server::swarm::update_member_status_with_report_tldr has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 11 (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.
  • jcode_app_core::server::swarm_persistence::load_runtime_state (cognitive 47) crates/jcode-app-core/src/server/swarm_persistence.rs:499 — jcode_app_core::server::swarm_persistence::load_runtime_state has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (41 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::usage_openai::parse_openai_usage_payload (cognitive 47) crates/jcode-app-core/src/usage_openai.rs:314 — jcode_app_core::usage_openai::parse_openai_usage_payload has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_app_core::replay::auto_edit_timeline (cognitive 46) crates/jcode-app-core/src/replay.rs:731 — jcode_app_core::replay::auto_edit_timeline has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (42 pts), match/switch 1 (2 pts), boolean chains 1, loops 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.
  • jcode_app_core::update::download_and_install_blocking_with_progress (cognitive 46) crates/jcode-app-core/src/update.rs:1119 — jcode_app_core::update::download_and_install_blocking_with_progress has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 3 (6 pts), boolean chains 4 (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.
  • + 81 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_tui · ×92
  • jcode_tui::tui::app::remote::server_events::handle_server_event (cyclomatic 366) crates/jcode-tui/src/tui/app/remote/server_events.rs:563 — jcode_tui::tui::app::remote::server_events::handle_server_event has cyclomatic complexity 366 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cyclomatic 219) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1067 — jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input has cyclomatic complexity 219 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal (cyclomatic 186) crates/jcode-tui/src/tui/app/remote/key_handling.rs:229 — jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal 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.
  • jcode_tui::tui::ui_viewport::draw_messages (cyclomatic 133) crates/jcode-tui/src/tui/ui_viewport.rs:399 — jcode_tui::tui::ui_viewport::draw_messages has cyclomatic complexity 133 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::ui_messages::render_tool_message (cyclomatic 102) crates/jcode-tui/src/tui/ui_messages.rs:4657 — jcode_tui::tui::ui_messages::render_tool_message has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::ui::draw_inner (cyclomatic 100) crates/jcode-tui/src/tui/ui.rs:2648 — jcode_tui::tui::ui::draw_inner has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::ui_inline_interactive::draw_inline_interactive (cyclomatic 92) crates/jcode-tui/src/tui/ui_inline_interactive.rs:564 — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::ui_tools::get_tool_summary_with_budget (cyclomatic 89) crates/jcode-tui/src/tui/ui_tools.rs:888 — jcode_tui::tui::ui_tools::get_tool_summary_with_budget has cyclomatic complexity 89 (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.
  • jcode_tui::tui::app::commands::handle_session_command (cyclomatic 75) crates/jcode-tui/src/tui/app/commands.rs:1676 — jcode_tui::tui::app::commands::handle_session_command has cyclomatic complexity 75 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui::tui::app::remote::process_remote_followups (cyclomatic 62) crates/jcode-tui/src/tui/app/remote.rs:1373 — jcode_tui::tui::app::remote::process_remote_followups 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.
  • jcode_tui::tui::ui_prepare::render_message_into (cyclomatic 57) crates/jcode-tui/src/tui/ui_prepare.rs:1327 — jcode_tui::tui::ui_prepare::render_message_into has cyclomatic complexity 57 (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.
  • jcode_tui::tui::app::remote::handle_tick (cyclomatic 54) crates/jcode-tui/src/tui/app/remote.rs:91 — jcode_tui::tui::app::remote::handle_tick 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.
  • jcode_tui::tui::info_widget_layout::calculate_placements_anchored (cyclomatic 54) crates/jcode-tui/src/tui/info_widget_layout.rs:125 — jcode_tui::tui::info_widget_layout::calculate_placements_anchored 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.
  • jcode_tui::tui::app::auth_account_commands::parse_account_command (cyclomatic 47) crates/jcode-tui/src/tui/app/auth_account_commands.rs:115 — jcode_tui::tui::app::auth_account_commands::parse_account_command has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::remote::handle_disconnected_key_internal (cyclomatic 45) crates/jcode-tui/src/tui/app/remote.rs:2072 — jcode_tui::tui::app::remote::handle_disconnected_key_internal has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command (cyclomatic 45) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:518 — jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::video_export::box_drawing_to_svg (cyclomatic 43) crates/jcode-tui/src/video_export.rs:933 — jcode_tui::video_export::box_drawing_to_svg has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • jcode_tui::tui::ui_input::draw_status (cyclomatic 39) crates/jcode-tui/src/tui/ui_input.rs:819 — jcode_tui::tui::ui_input::draw_status 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.
  • jcode_tui::tui::app::input::handle_pre_control_shortcuts (cyclomatic 38) crates/jcode-tui/src/tui/app/input.rs:2459 — jcode_tui::tui::app::input::handle_pre_control_shortcuts has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui::tui::app::state_ui::handle_info_command (cyclomatic 38) crates/jcode-tui/src/tui/app/state_ui.rs:1894 — jcode_tui::tui::app::state_ui::handle_info_command 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.
  • jcode_tui::video_export::buffer_to_svg (cyclomatic 38) crates/jcode-tui/src/video_export.rs:612 — jcode_tui::video_export::buffer_to_svg 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.
  • jcode_tui::tui::app::local::handle_bus_event (cyclomatic 36) crates/jcode-tui/src/tui/app/local.rs:193 — jcode_tui::tui::app::local::handle_bus_event has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • jcode_tui::tui::app::remote::reconnect::connect_with_retry (cyclomatic 36) crates/jcode-tui/src/tui/app/remote/reconnect.rs:476 — jcode_tui::tui::app::remote::reconnect::connect_with_retry 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.
  • jcode_tui::tui::ui_header::build_persistent_header_with_auth (cyclomatic 36) crates/jcode-tui/src/tui/ui_header.rs:563 — jcode_tui::tui::ui_header::build_persistent_header_with_auth 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.
  • jcode_tui::tui::info_widget::render_ambient_widget (cyclomatic 34) crates/jcode-tui/src/tui/info_widget.rs:2043 — jcode_tui::tui::info_widget::render_ambient_widget 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.
  • + 67 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×89
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/replay.rs:772 — crates/jcode-app-core/src/replay.rs:772-778 | crates/jcode-app-core/src/replay.rs:797-803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:887 — crates/jcode-app-core/src/server/client_actions.rs:887-893 | crates/jcode-app-core/src/tool/selfdev/launch.rs:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/server/client_api.rs:125 — crates/jcode-app-core/src/server/client_api.rs:125-132 | crates/jcode-app-core/src/server/client_api.rs:184-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/server/debug_swarm_write.rs:45 — crates/jcode-app-core/src/server/debug_swarm_write.rs:45-51 | crates/jcode-app-core/src/server/debug_swarm_write.rs:80-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/server/jade_relay.rs:333 — crates/jcode-app-core/src/server/jade_relay.rs:333-339 | crates/jcode-app-core/src/server/jade_relay.rs:687-693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/session_active_pids.rs:26 — crates/jcode-app-core/src/session_active_pids.rs:26-32 | crates/jcode-storage/src/active_pids.rs:194-200 — before extracting anything, compare `crates/jcode-app-core/src/session_active_pids.rs` and `crates/jcode-storage/src/active_pids.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/session_launch.rs:429 — crates/jcode-app-core/src/session_launch.rs:429-435 | crates/jcode-app-core/src/session_launch.rs:551-557 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/telemetry_state.rs:293 — crates/jcode-app-core/src/telemetry_state.rs:293-299 | crates/jcode-telemetry-core/src/state_support.rs:342-348 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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/jcode-app-core/src/tool/apply_patch.rs:628 — crates/jcode-app-core/src/tool/apply_patch.rs:628-634 | crates/jcode-app-core/src/tool/apply_patch.rs:641-647 — both copies are in the same file, so extract the block into 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/jcode-base/src/gmail.rs:401 — crates/jcode-base/src/gmail.rs:401-407 | crates/jcode-base/src/google_calendar.rs:134-140 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) crates/jcode-base/src/import.rs:1383 — crates/jcode-base/src/import.rs:1383-1389 | crates/jcode-tui/src/tui/session_picker/loading.rs:2761-2767 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.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. 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/jcode-base/src/jev.rs:560 — crates/jcode-base/src/jev.rs:560-568 | crates/jcode-base/src/jev/laya.rs:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/jcode-base/src/provider_catalog.rs:966 — crates/jcode-base/src/provider_catalog.rs:966-976 | crates/jcode-base/src/provider_catalog.rs:1107-1113 — both copies are in the same file, so extract the block into 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/jcode-base/src/session/persistence.rs:222 — crates/jcode-base/src/session/persistence.rs:222-228 | crates/jcode-tui/src/tui/session_picker/loading.rs:1607-1613 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/session/persistence.rs:407 — crates/jcode-base/src/session/persistence.rs:407-413 | crates/jcode-base/src/session/persistence.rs:562-568 — both copies are in the same file, so extract the block into 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/jcode-base/src/subscription_api.rs:667 — crates/jcode-base/src/subscription_api.rs:667-673 | crates/jcode-base/src/subscription_api.rs:688-694 — both copies are in the same file, so extract the block into 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/jcode-base/src/usage/display.rs:175 — crates/jcode-base/src/usage/display.rs:175-181 | crates/jcode-tui-usage-overlay/src/lib.rs:775-781 — before extracting anything, compare `crates/jcode-base/src/usage/display.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 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/jcode-command-risk/src/lib.rs:241 — crates/jcode-command-risk/src/lib.rs:241-247 | crates/jcode-command-risk/src/lib.rs:472-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-harness-api/src/sockets.rs:17 — crates/jcode-harness-api/src/sockets.rs:17-23 | crates/jcode-storage/src/lib.rs:111-117 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-overnight-core/src/lib.rs:312 — crates/jcode-overnight-core/src/lib.rs:312-318 | src/cli/acp.rs:1805-1811 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-core/src/auth_mode.rs:215 — crates/jcode-provider-core/src/auth_mode.rs:215-221 | crates/jcode-provider-core/src/auth_mode.rs:234-240 — both copies are in the same file, so extract the block into 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/jcode-provider-doctor/src/live_provider_probes.rs:176 — crates/jcode-provider-doctor/src/live_provider_probes.rs:176-182 | crates/jcode-provider-doctor/src/live_provider_probes.rs:245-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1514 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1514-1520 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2020-2026 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/jcode-provider-openrouter-runtime/src/lib.rs:1418 — crates/jcode-provider-openrouter-runtime/src/lib.rs:1418-1424 | crates/jcode-provider-openrouter-runtime/src/lib.rs:1433-1439 — both copies are in the same file, so extract the block into 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/jcode-telemetry-core/src/lib.rs:2507 — crates/jcode-telemetry-core/src/lib.rs:2507-2513 | crates/jcode-telemetry-core/src/lib.rs:2516-2522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 64 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×86
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/client_api.rs:107 — crates/jcode-app-core/src/server/client_api.rs:107-114 | crates/jcode-app-core/src/server/client_api.rs:149-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:202 — crates/jcode-app-core/src/server/client_lifecycle.rs:202-209 | crates/jcode-app-core/src/server/client_lifecycle.rs:1144-1151 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_state.rs:784 — crates/jcode-app-core/src/server/client_state.rs:784-791 | crates/jcode-app-core/src/server/client_state.rs:1089-1096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/debug_server_state.rs:863 — crates/jcode-app-core/src/server/debug_server_state.rs:863-870 | crates/jcode-app-core/src/server/debug_server_state.rs:917-925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/debug_server_state.rs:916 — crates/jcode-app-core/src/server/debug_server_state.rs:916-923 | crates/jcode-app-core/src/server/debug_server_state.rs:932-939 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/file_activity.rs:12 — crates/jcode-app-core/src/server/file_activity.rs:12-19 | crates/jcode-app-core/src/server/file_activity.rs:24-31 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/live_turn.rs:240 — crates/jcode-app-core/src/server/live_turn.rs:240-247 | crates/jcode-app-core/src/server/live_turn.rs:262-269 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/socket.rs:292 — crates/jcode-app-core/src/server/socket.rs:292-299 | src/cli/dispatch.rs:1100-1107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/tool/webfetch.rs:333 — crates/jcode-app-core/src/tool/webfetch.rs:333-340 | crates/jcode-app-core/src/tool/webfetch.rs:437-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/auth/claude.rs:448 — crates/jcode-base/src/auth/claude.rs:448-455 | crates/jcode-base/src/auth/claude.rs:468-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 (8 lines × 2) crates/jcode-base/src/auth/codex.rs:315 — crates/jcode-base/src/auth/codex.rs:315-322 | crates/jcode-base/src/auth/codex.rs:350-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/cache_tracker.rs:105 — crates/jcode-base/src/cache_tracker.rs:105-112 | crates/jcode-base/src/cache_tracker.rs:177-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/mcp/manager.rs:532 — crates/jcode-base/src/mcp/manager.rs:532-539 | crates/jcode-base/src/mcp/manager.rs:561-568 — both copies are in the same file, so extract the block into 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/jcode-base/src/runtime_memory_log.rs:636 — crates/jcode-base/src/runtime_memory_log.rs:636-643 | crates/jcode-base/src/runtime_memory_log.rs:663-670 — both copies are in the same file, so extract the block into 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/jcode-base/src/scratch_maintenance.rs:85 — crates/jcode-base/src/scratch_maintenance.rs:85-92 | crates/jcode-build-support/src/version_gc.rs:151-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/subscription_api.rs:287 — crates/jcode-base/src/subscription_api.rs:287-294 | crates/jcode-base/src/subscription_api.rs:429-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/usage/api_keys.rs:143 — crates/jcode-base/src/usage/api_keys.rs:143-150 | crates/jcode-base/src/usage/api_keys.rs:183-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-companion/src/server.rs:270 — crates/jcode-companion/src/server.rs:270-277 | src/cli/acp.rs:328-336 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-core/src/util.rs:40 — crates/jcode-core/src/util.rs:40-47 | crates/jcode-tui/src/tui/app/state_ui.rs:1050-1057 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-harness-api-server/src/translate.rs:1726 — crates/jcode-harness-api-server/src/translate.rs:1726-1733 | crates/jcode-harness-api-server/src/translate.rs:2046-2053 — both copies are in the same file, so extract the block into 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/jcode-provider-copilot/src/lib.rs:80 — crates/jcode-provider-copilot/src/lib.rs:80-87 | crates/jcode-provider-openai/src/request.rs:203-210 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-cursor-runtime/src/agent_transport.rs:1287 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1287-1294 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1361-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/jcode-provider-cursor-runtime/src/wire.rs:425 — crates/jcode-provider-cursor-runtime/src/wire.rs:425-432 | crates/jcode-provider-cursor-runtime/src/wire.rs:461-468 — both copies are in the same file, so extract the block into 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/jcode-provider-openai-runtime/src/openai_provider_impl.rs:254 — crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:254-261 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1245-1252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-provider-openai/src/stream.rs:24 — crates/jcode-provider-openai/src/stream.rs:24-31 | crates/jcode-provider-openai/src/websocket_health.rs:64-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 both call sites, so a change lands once.
  • + 61 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_base · ×75
  • jcode_base::session::render::render_messages_and_images_with_compacted_history (cognitive 75) crates/jcode-base/src/session/render.rs:344 — jcode_base::session::render::render_messages_and_images_with_compacted_history has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (53 pts), match/switch 4 (9 pts), loops 4 (8 pts), boolean chains 5 (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.
  • jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cognitive 66) crates/jcode-base/src/provider/catalog_remote_routes.rs:3 — jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (42 pts), match/switch 3 (10 pts), loops 3 (9 pts), boolean chains 5 (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.
  • jcode_base::browser::ensure_browser_setup_for (cognitive 57) crates/jcode-base/src/browser.rs:270 — jcode_base::browser::ensure_browser_setup_for has cognitive complexity 57 (threshold 15). Drivers by points: if/else 26 (36 pts), match/switch 7 (15 pts), boolean chains 6 (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.
  • jcode_base::provider_catalog::apply_named_provider_profile_env_from_config (cognitive 49) crates/jcode-base/src/provider_catalog.rs:930 — jcode_base::provider_catalog::apply_named_provider_profile_env_from_config has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (42 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::provider::models_catalog::parse_openai_model_catalog (cognitive 48) crates/jcode-base/src/provider/models_catalog.rs:80 — jcode_base::provider::models_catalog::parse_openai_model_catalog has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 3 (7 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::usage::openai_helpers::parse_openai_usage_payload (cognitive 47) crates/jcode-base/src/usage/openai_helpers.rs:328 — jcode_base::usage::openai_helpers::parse_openai_usage_payload has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_base::import::import_codex_session_from_path (cognitive 44) crates/jcode-base/src/import.rs:1069 — jcode_base::import::import_codex_session_from_path has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (40 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::auth::transfer::import_cloud_inner (cognitive 43) crates/jcode-base/src/auth/transfer.rs:1016 — jcode_base::auth::transfer::import_cloud_inner has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (26 pts), match/switch 6 (11 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::mcp::remote::streamable_post_inner (cognitive 42) crates/jcode-base/src/mcp/remote.rs:610 — jcode_base::mcp::remote::streamable_post_inner has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 10, loops 2 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::mcp::oauth::www_authenticate_param (cognitive 41) crates/jcode-base/src/mcp/oauth.rs:655 — jcode_base::mcp::oauth::www_authenticate_param has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::auth::assessment_for_key (cognitive 40) crates/jcode-base/src/auth/mod.rs:1130 — jcode_base::auth::assessment_for_key has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (39 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_base::import::list_claude_code_sessions (cognitive 39) crates/jcode-base/src/import.rs:201 — jcode_base::import::list_claude_code_sessions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (6 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.
  • jcode_base::gateway::handle_ws_connection (cognitive 38) crates/jcode-base/src/gateway.rs:146 — jcode_base::gateway::handle_ws_connection has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 3 (5 pts), loops 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.
  • jcode_base::goal::render_goal_detail (cognitive 34) crates/jcode-base/src/goal.rs:414 — jcode_base::goal::render_goal_detail has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 6 (13 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.
  • jcode_base::provider::catalog_routes::simplified_model_routes_for_picker (cognitive 32) crates/jcode-base/src/provider/catalog_routes.rs:24 — jcode_base::provider::catalog_routes::simplified_model_routes_for_picker has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (3 pts), boolean chains 2, 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.
  • jcode_base::provider::catalog_routes::expand_saved_account_routes (cognitive 32) crates/jcode-base/src/provider/catalog_routes.rs:174 — jcode_base::provider::catalog_routes::expand_saved_account_routes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (10 pts), boolean chains 3, match/switch 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::usage::api_keys::fetch_compatible_profile_report (cognitive 31) crates/jcode-base/src/usage/api_keys.rs:213 — jcode_base::usage::api_keys::fetch_compatible_profile_report has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 7 (14 pts), boolean chains 2 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_base::usage::provider_fetch::fetch_openai_usage_for_account (cognitive 31) crates/jcode-base/src/usage/provider_fetch.rs:153 — jcode_base::usage::provider_fetch::fetch_openai_usage_for_account has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 6 (11 pts), boolean chains 6, 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.
  • jcode_base::mcp::remote::sse_reader (cognitive 30) crates/jcode-base/src/mcp/remote.rs:850 — jcode_base::mcp::remote::sse_reader has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::memory::activity::parse_injected_items (cognitive 30) crates/jcode-base/src/memory/activity.rs:168 — jcode_base::memory::activity::parse_injected_items 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.
  • jcode_base::session::crash::find_crashed_legacy_scan (cognitive 30) crates/jcode-base/src/session/crash.rs:414 — jcode_base::session::crash::find_crashed_legacy_scan has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::transcript_sample::codex_turns (cognitive 30) crates/jcode-base/src/transcript_sample.rs:575 — jcode_base::transcript_sample::codex_turns has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::auth::lifecycle::parse_frontier_version_for_family (cognitive 28) crates/jcode-base/src/auth/lifecycle.rs:708 — jcode_base::auth::lifecycle::parse_frontier_version_for_family has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::provider::catalog_routes::append_openrouter_routes (cognitive 27) crates/jcode-base/src/provider/catalog_routes.rs:796 — jcode_base::provider::catalog_routes::append_openrouter_routes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::auth::login_diagnostics::classify_auth_failure_message (cognitive 26) crates/jcode-base/src/auth/login_diagnostics.rs:38 — jcode_base::auth::login_diagnostics::classify_auth_failure_message has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 13. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • + 50 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×74
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/channel.rs:630 — crates/jcode-app-core/src/channel.rs:630-635 | crates/jcode-app-core/src/server/jade_relay.rs:1305-1310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/replay.rs:636 — crates/jcode-app-core/src/replay.rs:636-641 | crates/jcode-base/src/session/crash.rs:642-647 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/server/client_actions.rs:883 — crates/jcode-app-core/src/server/client_actions.rs:883-888 | crates/jcode-tui/src/tui/app/commands.rs:380-385 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:1485 — crates/jcode-app-core/src/server/comm_control.rs:1485-1490 | crates/jcode-app-core/src/server/comm_session.rs:854-859 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:2029 — crates/jcode-app-core/src/server/comm_control.rs:2029-2034 | crates/jcode-app-core/src/server/comm_control.rs:2055-2060 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_jobs.rs:88 — crates/jcode-app-core/src/server/debug_jobs.rs:88-93 | crates/jcode-app-core/src/server/debug_jobs.rs:117-122 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_server_state.rs:830 — crates/jcode-app-core/src/server/debug_server_state.rs:830-835 | crates/jcode-app-core/src/server/debug_server_state.rs:841-846 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_swarm_read.rs:241 — crates/jcode-app-core/src/server/debug_swarm_read.rs:241-246 | crates/jcode-app-core/src/server/debug_swarm_read.rs:317-322 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_swarm_read.rs:553 — crates/jcode-app-core/src/server/debug_swarm_read.rs:553-558 | crates/jcode-app-core/src/server/debug_swarm_read.rs:609-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/server/jade_relay.rs:319 — crates/jcode-app-core/src/server/jade_relay.rs:319-324 | crates/jcode-app-core/src/server/jade_relay.rs:671-676 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/ssh_remote.rs:136 — crates/jcode-app-core/src/ssh_remote.rs:136-141 | crates/jcode-app-core/src/ssh_remote.rs:152-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:321 — crates/jcode-app-core/src/telemetry_state.rs:321-326 | crates/jcode-telemetry-core/src/state_support.rs:388-393 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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 × 2) crates/jcode-app-core/src/tool/apply_patch.rs:144 — crates/jcode-app-core/src/tool/apply_patch.rs:144-149 | crates/jcode-app-core/src/tool/apply_patch.rs:224-229 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/browser_request.rs:93 — crates/jcode-app-core/src/tool/browser_request.rs:93-98 | crates/jcode-app-core/src/tool/browser_request.rs:192-197 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/conversation_search.rs:200 — crates/jcode-app-core/src/tool/conversation_search.rs:200-205 | crates/jcode-base/src/memory_agent.rs:54-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/tool/selfdev/mod.rs:250 — crates/jcode-app-core/src/tool/selfdev/mod.rs:250-255 | crates/jcode-base/src/goal.rs:547-552 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/compaction.rs:931 — crates/jcode-base/src/compaction.rs:931-936 | crates/jcode-base/src/compaction.rs:1147-1152 — both copies are in the same file, so extract the block into 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/jcode-base/src/import.rs:1127 — crates/jcode-base/src/import.rs:1127-1132 | crates/jcode-import-core/src/lib.rs:677-682 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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 × 2) crates/jcode-base/src/mcp/client.rs:322 — crates/jcode-base/src/mcp/client.rs:322-327 | crates/jcode-base/src/mcp/client.rs:366-371 — both copies are in the same file, so extract the block into 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/jcode-base/src/platform.rs:156 — crates/jcode-base/src/platform.rs:156-161 | crates/jcode-base/src/skill.rs:210-216 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/jcode-base/src/provider/openrouter.rs:159 — crates/jcode-base/src/provider/openrouter.rs:159-164 | crates/jcode-provider-openrouter-runtime/src/lib.rs:169-174 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 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 × 2) crates/jcode-base/src/provider/openrouter.rs:177 — crates/jcode-base/src/provider/openrouter.rs:177-182 | crates/jcode-provider-openrouter-runtime/src/lib.rs:187-192 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 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 × 2) crates/jcode-base/src/session/memory_profile.rs:92 — crates/jcode-base/src/session/memory_profile.rs:92-97 | crates/jcode-tui/src/tui/memory_profile.rs:219-224 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/jcode-base/src/sidecar.rs:1003 — crates/jcode-base/src/sidecar.rs:1003-1008 | crates/jcode-provider-copilot-runtime/src/lib.rs:781-786 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/skill.rs:705 — crates/jcode-base/src/skill.rs:705-710 | crates/jcode-base/src/skill/invocation.rs:31-36 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • + 49 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×67
  • Duplicated block (10 lines × 2) crates/jcode-app-core/src/agent/status.rs:155 — crates/jcode-app-core/src/agent/status.rs:155-164 | crates/jcode-app-core/src/agent/turn_execution.rs:1481-1490 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 × 2) crates/jcode-app-core/src/message_notifications.rs:145 — crates/jcode-app-core/src/message_notifications.rs:145-154 | crates/jcode-base/src/message/notifications.rs:490-499 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 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/jcode-app-core/src/server/client_actions.rs:860 — crates/jcode-app-core/src/server/client_actions.rs:860-869 | crates/jcode-tui/src/tui/app/commands.rs:357-366 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/jcode-app-core/src/server/debug_swarm_write.rs:375 — crates/jcode-app-core/src/server/debug_swarm_write.rs:375-384 | crates/jcode-app-core/src/server/debug_swarm_write.rs:483-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 (10 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:83 — crates/jcode-app-core/src/telemetry_state.rs:83-92 | crates/jcode-telemetry-core/src/state_support.rs:81-90 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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/jcode-app-core/src/tool/discover.rs:1053 — crates/jcode-app-core/src/tool/discover.rs:1053-1062 | crates/jcode-app-core/src/tool/discover.rs:1247-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.
  • Duplicated block (10 lines × 2) crates/jcode-app-core/src/tool/read.rs:457 — crates/jcode-app-core/src/tool/read.rs:457-466 | crates/jcode-app-core/src/tool/read.rs:511-520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/jcode-app-core/src/tool/session_search.rs:1114 — crates/jcode-app-core/src/tool/session_search.rs:1114-1123 | crates/jcode-app-core/src/tool/session_search.rs:1228-1237 — both copies are in the same file, so extract the block into 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/jcode-base/src/auth/refresh_state.rs:272 — crates/jcode-base/src/auth/refresh_state.rs:272-281 | crates/jcode-base/src/auth/validation.rs:62-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 both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) crates/jcode-base/src/background.rs:199 — crates/jcode-base/src/background.rs:199-208 | crates/jcode-base/src/background.rs:294-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/jcode-base/src/browser.rs:1221 — crates/jcode-base/src/browser.rs:1221-1230 | crates/jcode-base/src/browser.rs:1266-1275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/jcode-base/src/cloud_environment.rs:312 — crates/jcode-base/src/cloud_environment.rs:312-321 | crates/jcode-base/src/cloud_environment.rs:450-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 (10 lines × 2) crates/jcode-base/src/compaction.rs:940 — crates/jcode-base/src/compaction.rs:940-949 | crates/jcode-base/src/compaction.rs:1155-1164 — both copies are in the same file, so extract the block into 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/jcode-base/src/memory.rs:492 — crates/jcode-base/src/memory.rs:492-501 | crates/jcode-base/src/memory.rs:513-522 — both copies are in the same file, so extract the block into 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/jcode-base/src/memory/pending.rs:590 — crates/jcode-base/src/memory/pending.rs:590-599 | crates/jcode-base/src/memory/pending.rs:645-654 — both copies are in the same file, so extract the block into 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/jcode-base/src/prompt.rs:392 — crates/jcode-base/src/prompt.rs:392-401 | crates/jcode-base/src/prompt.rs:529-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 (10 lines × 2) crates/jcode-base/src/provider/mod.rs:2963 — crates/jcode-base/src/provider/mod.rs:2963-2972 | crates/jcode-base/src/provider/startup.rs:302-311 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-base/src/provider_activity_oauth.rs:246 — crates/jcode-base/src/provider_activity_oauth.rs:246-255 | crates/jcode-base/src/provider_activity_oauth.rs:368-377 — both copies are in the same file, so extract the block into 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/jcode-base/src/session/prewarm.rs:102 — crates/jcode-base/src/session/prewarm.rs:102-111 | crates/jcode-storage/src/active_pids.rs:147-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/skill.rs:488 — crates/jcode-base/src/skill.rs:488-497 | crates/jcode-base/src/skill.rs:663-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 (10 lines × 2) crates/jcode-base/src/usage/api_keys.rs:339 — crates/jcode-base/src/usage/api_keys.rs:339-348 | crates/jcode-base/src/usage/api_keys.rs:394-403 — both copies are in the same file, so extract the block into 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/jcode-base/src/usage/api_keys.rs:443 — crates/jcode-base/src/usage/api_keys.rs:443-452 | crates/jcode-base/src/usage/api_keys.rs:613-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/jcode-harness-api-server/src/translate.rs:2794 — crates/jcode-harness-api-server/src/translate.rs:2794-2803 | crates/jcode-harness-api-server/src/translate.rs:2810-2819 — both copies are in the same file, so extract the block into 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/jcode-provider-anthropic-runtime/src/error_classification.rs:29 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:29-38 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2331-2341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-cursor-runtime/src/agent_transport.rs:1210 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1210-1219 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1297-1306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 42 more in this group — see findings.md.
D2 · Cognitive Complexity · App · ×66
  • App::run_turn_interactive (cognitive 763) crates/jcode-tui/src/tui/app/turn.rs:85 — App::run_turn_interactive has cognitive complexity 763 (threshold 15). Drivers by points: if/else 125 (625 pts), match/switch 17 (72 pts), loops 13 (52 pts), boolean chains 14 (nesting depth added 594). 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.
  • App::handle_debug_command (cognitive 218) crates/jcode-tui/src/tui/app/debug_cmds.rs:93 — App::handle_debug_command has cognitive complexity 218 (threshold 15). Drivers by points: if/else 130 (146 pts), match/switch 24 (45 pts), boolean chains 22, loops 2 (5 pts) (nesting depth added 40). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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::handle_inline_interactive_key (cognitive 217) crates/jcode-tui/src/tui/app/inline_interactive.rs:3511 — App::handle_inline_interactive_key has cognitive complexity 217 (threshold 15). Drivers by points: if/else 74 (174 pts), match/switch 7 (20 pts), boolean chains 18, loops 1 (5 pts) (nesting depth added 117). To reduce it, split the body into named stages: move each independent 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::handle_mouse_event (cognitive 206) crates/jcode-tui/src/tui/app/navigation.rs:1366 — App::handle_mouse_event has cognitive complexity 206 (threshold 15). Drivers by points: if/else 89 (168 pts), boolean chains 19, match/switch 12 (19 pts) (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_login_input (cognitive 127) crates/jcode-tui/src/tui/app/auth.rs:1841 — App::handle_login_input has cognitive complexity 127 (threshold 15). Drivers by points: if/else 44 (88 pts), match/switch 15 (30 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::get_suggestions_for (cognitive 103) crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:536 — App::get_suggestions_for has cognitive complexity 103 (threshold 15). Drivers by points: if/else 69 (85 pts), boolean chains 10, loops 3 (8 pts) (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::build_model_picker_entries (cognitive 97) crates/jcode-tui/src/tui/app/inline_interactive.rs:1716 — App::build_model_picker_entries has cognitive complexity 97 (threshold 15). Drivers by points: if/else 33 (63 pts), loops 9 (21 pts), boolean chains 8, match/switch 2 (5 pts) (nesting depth added 45). Of this number, 92 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.
  • App::run_remote (cognitive 90) crates/jcode-tui/src/tui/app/run_shell.rs:788 — App::run_remote has cognitive complexity 90 (threshold 15). Drivers by points: if/else 28 (70 pts), match/switch 5 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • App::info_widget_data (cognitive 74) crates/jcode-tui/src/tui/app/tui_state.rs:1557 — App::info_widget_data has cognitive complexity 74 (threshold 15). Drivers by points: if/else 43 (56 pts), boolean chains 12, match/switch 3 (6 pts) (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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::context_snapshot (cognitive 60) crates/jcode-tui/src/tui/app/tui_state.rs:1287 — App::context_snapshot has cognitive complexity 60 (threshold 15). Drivers by points: if/else 24 (37 pts), match/switch 5 (13 pts), loops 3 (7 pts), boolean chains 3 (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.
  • App::trigger_provider_auth_changed (cognitive 55) crates/jcode-tui/src/tui/app/auth.rs:2638 — App::trigger_provider_auth_changed has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (50 pts), boolean chains 5 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • App::collect_missing_tool_outputs_since_last_scan (cognitive 55) crates/jcode-tui/src/tui/app/conversation_state.rs:601 — App::collect_missing_tool_outputs_since_last_scan has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 6 (15 pts), match/switch 4 (11 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.
  • App::run (cognitive 50) crates/jcode-tui/src/tui/app/run_shell.rs:651 — App::run has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (41 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::schedule_auto_poke_followup_after_response (cognitive 48) crates/jcode-tui/src/tui/app/input.rs:1598 — App::schedule_auto_poke_followup_after_response has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 11 (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.
  • App::open_model_picker_inner (cognitive 46) crates/jcode-tui/src/tui/app/inline_interactive.rs:1209 — App::open_model_picker_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 29 (42 pts), boolean chains 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.
  • App::handle_login_completed (cognitive 44) crates/jcode-tui/src/tui/app/auth.rs:3111 — App::handle_login_completed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 8, match/switch 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.
  • App::run_scroll_test (cognitive 41) crates/jcode-tui/src/tui/app/debug_bench.rs:717 — App::run_scroll_test has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (23 pts), match/switch 4 (9 pts), loops 6 (8 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.
  • App::submit_input (cognitive 41) crates/jcode-tui/src/tui/app/input.rs:3925 — App::submit_input has cognitive complexity 41 (threshold 15). Drivers by points: if/else 26 (36 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_key_core (cognitive 40) crates/jcode-tui/src/tui/app/input.rs:3169 — App::handle_key_core has cognitive complexity 40 (threshold 15). Drivers by points: if/else 29 (32 pts), boolean chains 6, 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::open_agent_model_picker (cognitive 39) crates/jcode-tui/src/tui/app/inline_interactive/openers.rs:216 — App::open_agent_model_picker has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 6 (15 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.
  • App::run_fix_command (cognitive 39) crates/jcode-tui/src/tui/app/model_context.rs:1826 — App::run_fix_command has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 4 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::restore_session (cognitive 36) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:307 — App::restore_session has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_ssh_login_key (cognitive 35) crates/jcode-tui/src/tui/app/auth_remote.rs:329 — App::handle_ssh_login_key has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 10, match/switch 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::eval_assertions (cognitive 35) crates/jcode-tui/src/tui/app/debug_script.rs:44 — App::eval_assertions has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 16 (31 pts), if/else 2 (3 pts), loops 1 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • App::handle_session_picker_selection (cognitive 35) crates/jcode-tui/src/tui/app/inline_interactive.rs:2909 — App::handle_session_picker_selection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 3 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 41 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×65
  • Duplicated block (9 lines × 2) crates/jcode-app-core/src/ambient/runner.rs:205 — crates/jcode-app-core/src/ambient/runner.rs:205-213 | crates/jcode-tui/src/tui/app/helpers.rs:1426-1434 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/server/comm_session.rs:1105 — crates/jcode-app-core/src/server/comm_session.rs:1105-1113 | crates/jcode-app-core/src/server/comm_sync.rs:401-410 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-app-core/src/server/debug_server_state.rs:737 — crates/jcode-app-core/src/server/debug_server_state.rs:737-745 | crates/jcode-app-core/src/server/debug_server_state.rs:747-755 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/session_launch.rs:298 — crates/jcode-app-core/src/session_launch.rs:298-306 | crates/jcode-app-core/src/session_launch.rs:554-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 (9 lines × 2) crates/jcode-app-core/src/tool/agentgrep/context.rs:836 — crates/jcode-app-core/src/tool/agentgrep/context.rs:836-844 | crates/jcode-app-core/src/tool/agentgrep/context.rs:871-879 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/browser.rs:475 — crates/jcode-app-core/src/tool/browser.rs:475-483 | crates/jcode-app-core/src/tool/browser.rs:494-502 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/session_search.rs:1482 — crates/jcode-app-core/src/tool/session_search.rs:1482-1490 | crates/jcode-app-core/src/tool/session_search.rs:1741-1749 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_openai.rs:194 — crates/jcode-app-core/src/usage_openai.rs:194-202 | crates/jcode-base/src/usage/openai_helpers.rs:208-216 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (9 lines × 2) crates/jcode-base/src/import.rs:1117 — crates/jcode-base/src/import.rs:1117-1125 | crates/jcode-tui/src/tui/session_picker/loading.rs:2259-2269 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.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. 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 (9 lines × 2) crates/jcode-base/src/mcp/manager.rs:521 — crates/jcode-base/src/mcp/manager.rs:521-529 | crates/jcode-base/src/mcp/manager.rs:552-560 — both copies are in the same file, so extract the block into 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/jcode-base/src/prompt.rs:22 — crates/jcode-base/src/prompt.rs:22-30 | crates/jcode-base/src/prompt.rs:84-92 — both copies are in the same file, so extract the block into 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/jcode-base/src/safety.rs:385 — crates/jcode-base/src/safety.rs:385-393 | crates/jcode-base/src/safety.rs:421-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 (9 lines × 2) crates/jcode-base/src/safety.rs:397 — crates/jcode-base/src/safety.rs:397-405 | crates/jcode-base/src/safety.rs:446-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/jcode-base/src/subscription_api.rs:288 — crates/jcode-base/src/subscription_api.rs:288-296 | crates/jcode-base/src/subscription_api.rs:513-521 — both copies are in the same file, so extract the block into 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/jcode-import-core/src/lib.rs:866 — crates/jcode-import-core/src/lib.rs:866-874 | crates/jcode-tui/src/tui/session_picker/loading.rs:2738-2746 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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 (9 lines × 2) crates/jcode-provider-copilot-runtime/src/lib.rs:164 — crates/jcode-provider-copilot-runtime/src/lib.rs:164-172 | crates/jcode-provider-copilot-runtime/src/lib.rs:201-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/jcode-provider-copilot/src/lib.rs:142 — crates/jcode-provider-copilot/src/lib.rs:142-150 | crates/jcode-provider-openrouter/src/request.rs:190-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 (9 lines × 2) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:582 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:582-590 | crates/jcode-provider-cursor-runtime/src/wire.rs:102-110 — before extracting anything, compare `crates/jcode-provider-cursor-runtime/src/agent_transport.rs` and `crates/jcode-provider-cursor-runtime/src/wire.rs` as WHOLE FILES: this scan already matched 4 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:164 — crates/jcode-provider-doctor/src/live_provider_probes.rs:164-172 | crates/jcode-provider-doctor/src/live_provider_probes.rs:232-240 — both copies are in the same file, so extract the block into 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/jcode-provider-openrouter-runtime/src/lib.rs:671 — crates/jcode-provider-openrouter-runtime/src/lib.rs:671-679 | crates/jcode-provider-openrouter-runtime/src/lib.rs:779-787 — both copies are in the same file, so extract the block into 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/jcode-render-core/src/math.rs:614 — crates/jcode-render-core/src/math.rs:614-622 | crates/jcode-render-core/src/preprocess.rs:660-668 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-setup-hints/src/lib.rs:1738 — crates/jcode-setup-hints/src/lib.rs:1738-1746 | crates/jcode-setup-hints/src/lib.rs:1795-1803 — both copies are in the same file, so extract the block into 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/jcode-todo-policy/src/lib.rs:564 — crates/jcode-todo-policy/src/lib.rs:564-572 | crates/jcode-todo-policy/src/lib.rs:587-595 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/lib.rs:78 — crates/jcode-tui-render/src/lib.rs:78-86 | crates/jcode-tui-render/src/lib.rs:127-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/jcode-tui-style/src/color.rs:329 — crates/jcode-tui-style/src/color.rs:329-337 | crates/jcode-tui-workspace/src/color_support.rs:291-299 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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.
  • + 40 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_app_core · ×60
  • jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 247) crates/jcode-app-core/src/server/client_lifecycle.rs:351 — jcode_app_core::server::client_lifecycle::handle_client has cyclomatic complexity 247 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::debug_command_exec::execute_debug_command (cyclomatic 78) crates/jcode-app-core/src/server/debug_command_exec.rs:162 — jcode_app_core::server::debug_command_exec::execute_debug_command 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.
  • jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command (cyclomatic 73) crates/jcode-app-core/src/server/debug_swarm_read.rs:21 — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::runtime_commands::execute (cyclomatic 70) crates/jcode-app-core/src/server/runtime_commands.rs:34 — jcode_app_core::server::runtime_commands::execute has cyclomatic complexity 70 (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.
  • jcode_app_core::tool::browser_request::bridge_request (cyclomatic 70) crates/jcode-app-core/src/tool/browser_request.rs:3 — jcode_app_core::tool::browser_request::bridge_request has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command (cyclomatic 50) crates/jcode-app-core/src/server/debug_swarm_write.rs:19 — jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command 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.
  • jcode_app_core::tool::browser_fast::run (cyclomatic 48) crates/jcode-app-core/src/tool/browser_fast.rs:583 — jcode_app_core::tool::browser_fast::run 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.
  • jcode_app_core::server::client_session::handle_resume_session (cyclomatic 43) crates/jcode-app-core/src/server/client_session.rs:1390 — jcode_app_core::server::client_session::handle_resume_session 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.
  • jcode_app_core::server::client_comm_message::handle_comm_message (cyclomatic 42) crates/jcode-app-core/src/server/client_comm_message.rs:103 — jcode_app_core::server::client_comm_message::handle_comm_message 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.
  • jcode_app_core::server::comm_control::handle_comm_task_control (cyclomatic 42) crates/jcode-app-core/src/server/comm_control.rs:1745 — jcode_app_core::server::comm_control::handle_comm_task_control 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.
  • jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request (cyclomatic 40) crates/jcode-app-core/src/server/client_lightweight_control.rs:246 — jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request 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.
  • jcode_app_core::tool::selfdev::status::selfdev_status_output (cyclomatic 38) crates/jcode-app-core/src/tool/selfdev/status.rs:3 — jcode_app_core::tool::selfdev::status::selfdev_status_output 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.
  • jcode_app_core::server::debug::handle_debug_client (cyclomatic 36) crates/jcode-app-core/src/server/debug.rs:253 — jcode_app_core::server::debug::handle_debug_client 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.
  • jcode_app_core::tool::browser_fast_actions::candidates (cyclomatic 36) crates/jcode-app-core/src/tool/browser_fast_actions.rs:158 — jcode_app_core::tool::browser_fast_actions::candidates 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.
  • jcode_app_core::server::group_transfer::handle_with_gate (cyclomatic 33) crates/jcode-app-core/src/server/group_transfer.rs:248 — jcode_app_core::server::group_transfer::handle_with_gate 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.
  • jcode_app_core::tool::apply_patch::parse_apply_patch (cyclomatic 32) crates/jcode-app-core/src/tool/apply_patch.rs:661 — jcode_app_core::tool::apply_patch::parse_apply_patch 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.
  • jcode_app_core::tool::todo::apply_todo_patch (cyclomatic 32) crates/jcode-app-core/src/tool/todo.rs:229 — jcode_app_core::tool::todo::apply_todo_patch 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.
  • jcode_app_core::server::client_session::handle_subscribe (cyclomatic 28) crates/jcode-app-core/src/server/client_session.rs:562 — jcode_app_core::server::client_session::handle_subscribe 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.
  • jcode_app_core::server::swarm::update_member_status_with_report_tldr (cyclomatic 28) crates/jcode-app-core/src/server/swarm.rs:1654 — jcode_app_core::server::swarm::update_member_status_with_report_tldr 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.
  • jcode_app_core::server::headless::create_headless_session (cyclomatic 27) crates/jcode-app-core/src/server/headless.rs:37 — jcode_app_core::server::headless::create_headless_session 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.
  • jcode_app_core::tool::browser_fast::scoped (cyclomatic 27) crates/jcode-app-core/src/tool/browser_fast.rs:190 — jcode_app_core::tool::browser_fast::scoped has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • jcode_app_core::server::client_disconnect_cleanup::cleanup_client_connection (cyclomatic 26) crates/jcode-app-core/src/server/client_disconnect_cleanup.rs:93 — jcode_app_core::server::client_disconnect_cleanup::cleanup_client_connection 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.
  • jcode_app_core::server::debug_testers::execute_tester_subcommand (cyclomatic 26) crates/jcode-app-core/src/server/debug_testers.rs:252 — jcode_app_core::server::debug_testers::execute_tester_subcommand 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.
  • jcode_app_core::tool::communicate::run_swarm_plan_loop (cyclomatic 26) crates/jcode-app-core/src/tool/communicate.rs:1137 — jcode_app_core::tool::communicate::run_swarm_plan_loop 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.
  • jcode_app_core::replay::export_timeline (cyclomatic 25) crates/jcode-app-core/src/replay.rs:138 — jcode_app_core::replay::export_timeline 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.
  • + 35 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode · ×58
  • jcode::bin::memory_recall_bench::cmd_metrics (cognitive 176) src/bin/memory_recall_bench.rs:1014 — jcode::bin::memory_recall_bench::cmd_metrics has cognitive complexity 176 (threshold 15). Drivers by points: if/else 51 (102 pts), loops 16 (45 pts), match/switch 9 (23 pts), boolean chains 6 (nesting depth added 94). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::commands::run_memory_command_for_dir (cognitive 114) src/cli/commands.rs:1615 — jcode::cli::commands::run_memory_command_for_dir has cognitive complexity 114 (threshold 15). Drivers by points: if/else 28 (64 pts), loops 9 (31 pts), boolean chains 11, match/switch 4 (8 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.
  • jcode::bin::memory_recall_bench::cmd_gate (cognitive 108) src/bin/memory_recall_bench.rs:2189 — jcode::bin::memory_recall_bench::cmd_gate has cognitive complexity 108 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 9 (21 pts), match/switch 7 (20 pts), boolean chains 7 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::tui_launch::list_sessions (cognitive 82) src/cli/tui_launch.rs:499 — jcode::cli::tui_launch::list_sessions has cognitive complexity 82 (threshold 15). Drivers by points: if/else 18 (49 pts), match/switch 8 (18 pts), boolean chains 8, loops 3 (7 pts) (nesting depth added 45). Of this number, 80 points are the body's own statements and 2 belong to 2 function items inside it that branch. 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.
  • jcode::bin::tui_bench::main (cognitive 75) src/bin/tui_bench.rs:1212 — jcode::bin::tui_bench::main has cognitive complexity 75 (threshold 15). Drivers by points: if/else 44 (71 pts), boolean chains 3, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::provider_init::init_provider_with_model_policy (cognitive 74) src/cli/provider_init.rs:1525 — jcode::cli::provider_init::init_provider_with_model_policy has cognitive complexity 74 (threshold 15). Drivers by points: if/else 32 (58 pts), boolean chains 15, 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.
  • jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session (cognitive 56) src/bin/tui_bench.rs:659 — jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (49 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 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.
  • jcode::cli::commands::run_single_message_command_ndjson (cognitive 52) src/cli/commands.rs:3467 — jcode::cli::commands::run_single_message_command_ndjson has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (34 pts), match/switch 4 (10 pts), loops 3 (7 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.
  • jcode::cli::dispatch::run_main (cognitive 52) src/cli/dispatch.rs:74 — jcode::cli::dispatch::run_main has cognitive complexity 52 (threshold 15). Drivers by points: if/else 26 (35 pts), match/switch 8 (15 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::cloud_group_run::run_migrate (cognitive 48) src/cli/cloud_group_run.rs:3 — jcode::cli::cloud_group_run::run_migrate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (39 pts), loops 5 (6 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.
  • jcode::cli::commands::prepare_run_todo_follow_up (cognitive 48) src/cli/commands.rs:2968 — jcode::cli::commands::prepare_run_todo_follow_up has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 7 (15 pts), boolean chains 6, match/switch 2 (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.
  • jcode::cli::ssh_transport::accept_connections (cognitive 44) REDACTED:488 — jcode::cli::ssh_transport::accept_connections has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (31 pts), match/switch 4 (11 pts), loops 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.
  • jcode::cli::cloud_group_receive::activate (cognitive 41) src/cli/cloud_group_receive.rs:61 — jcode::cli::cloud_group_receive::activate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::commands::run_server_stop_command (cognitive 41) src/cli/commands.rs:2455 — jcode::cli::commands::run_server_stop_command has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 5, match/switch 1 (3 pts), loops 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.
  • jcode::cli::login::login_openai_compatible_flow (cognitive 38) src/cli/login.rs:843 — jcode::cli::login::login_openai_compatible_flow has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (29 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::commands::run_cloud_sessions_sync (cognitive 36) src/cli/commands.rs:626 — jcode::cli::commands::run_cloud_sessions_sync has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (7 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.
  • jcode::cli::cloud_move::run_cli (cognitive 34) src/cli/cloud_move.rs:2304 — jcode::cli::cloud_move::run_cli has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (23 pts), match/switch 3 (6 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode::cli::tui_launch::run_replay_command (cognitive 34) src/cli/tui_launch.rs:268 — jcode::cli::tui_launch::run_replay_command has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (32 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.
  • jcode::cli::cloud_move::run_move (cognitive 33) src/cli/cloud_move.rs:846 — jcode::cli::cloud_move::run_move has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (23 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.
  • jcode::cli::commands::run_single_message_command_plain_with_auto_poke (cognitive 33) src/cli/commands.rs:3231 — jcode::cli::commands::run_single_message_command_plain_with_auto_poke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (29 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode::cli::commands::run_single_message_command_capture_with_auto_poke) 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.
  • jcode::cli::commands::run_single_message_command_capture_with_auto_poke (cognitive 33) src/cli/commands.rs:3347 — jcode::cli::commands::run_single_message_command_capture_with_auto_poke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (29 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode::cli::commands::run_single_message_command_plain_with_auto_poke) 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.
  • jcode::cli::dispatch::run_default_command (cognitive 33) src/cli/dispatch.rs:788 — jcode::cli::dispatch::run_default_command has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 9 (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.
  • jcode::cli::login::run_login_provider (cognitive 33) src/cli/login.rs:258 — jcode::cli::login::run_login_provider has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • jcode::cli::cloud_env::exchange_bounded (cognitive 30) src/cli/cloud_env.rs:137 — jcode::cli::cloud_env::exchange_bounded has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 2 (7 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::cloud_move::restore_repo (cognitive 29) src/cli/cloud_move.rs:1963 — jcode::cli::cloud_move::restore_repo has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 1 (2 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.
  • + 33 more in this group — see findings.md.
D1 · Cyclomatic Complexity · App · ×54
  • App::run_turn_interactive (cyclomatic 219) crates/jcode-tui/src/tui/app/turn.rs:85 — App::run_turn_interactive has cyclomatic complexity 219 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_debug_command (cyclomatic 175) crates/jcode-tui/src/tui/app/debug_cmds.rs:93 — App::handle_debug_command has cyclomatic complexity 175 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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::handle_mouse_event (cyclomatic 128) crates/jcode-tui/src/tui/app/navigation.rs:1366 — App::handle_mouse_event has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_inline_interactive_key (cyclomatic 109) crates/jcode-tui/src/tui/app/inline_interactive.rs:3511 — App::handle_inline_interactive_key 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.
  • App::get_suggestions_for (cyclomatic 78) crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:536 — App::get_suggestions_for has cyclomatic complexity 78 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::handle_login_input (cyclomatic 77) crates/jcode-tui/src/tui/app/auth.rs:1841 — App::handle_login_input 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.
  • App::build_model_picker_entries (cyclomatic 52) crates/jcode-tui/src/tui/app/inline_interactive.rs:1716 — App::build_model_picker_entries has cyclomatic complexity 52 (threshold 15). Of this number, 45 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.
  • App::eval_assertions (cyclomatic 51) crates/jcode-tui/src/tui/app/debug_script.rs:44 — App::eval_assertions has cyclomatic complexity 51 (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.
  • App::info_widget_data (cyclomatic 43) crates/jcode-tui/src/tui/app/tui_state.rs:1557 — App::info_widget_data 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.
  • App::run_remote (cyclomatic 39) crates/jcode-tui/src/tui/app/run_shell.rs:788 — App::run_remote 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.
  • App::handle_key_core (cyclomatic 37) crates/jcode-tui/src/tui/app/input.rs:3169 — App::handle_key_core 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.
  • App::context_snapshot (cyclomatic 37) crates/jcode-tui/src/tui/app/tui_state.rs:1287 — App::context_snapshot 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.
  • App::handle_ssh_login_key (cyclomatic 33) crates/jcode-tui/src/tui/app/auth_remote.rs:329 — App::handle_ssh_login_key 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.
  • App::schedule_auto_poke_followup_after_response (cyclomatic 33) crates/jcode-tui/src/tui/app/input.rs:1598 — App::schedule_auto_poke_followup_after_response 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.
  • App::handle_onboarding_import_review_key (cyclomatic 31) crates/jcode-tui/src/tui/app/onboarding_flow_control.rs:555 — App::handle_onboarding_import_review_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.
  • App::handle_login_completed (cyclomatic 27) crates/jcode-tui/src/tui/app/auth.rs:3111 — App::handle_login_completed 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.
  • App::open_account_center (cyclomatic 27) crates/jcode-tui/src/tui/app/auth_account_picker.rs:10 — App::open_account_center 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.
  • App::submit_input (cyclomatic 26) crates/jcode-tui/src/tui/app/input.rs:3925 — App::submit_input 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.
  • App::run_scroll_test (cyclomatic 25) crates/jcode-tui/src/tui/app/debug_bench.rs:717 — App::run_scroll_test 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.
  • App::open_model_picker_inner (cyclomatic 25) crates/jcode-tui/src/tui/app/inline_interactive.rs:1209 — App::open_model_picker_inner 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.
  • App::open_account_picker (cyclomatic 24) crates/jcode-tui/src/tui/app/auth_account_picker.rs:330 — App::open_account_picker 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.
  • App::handle_session_picker_selection (cyclomatic 24) crates/jcode-tui/src/tui/app/inline_interactive.rs:2909 — App::handle_session_picker_selection 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.
  • App::run (cyclomatic 23) crates/jcode-tui/src/tui/app/run_shell.rs:651 — App::run 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.
  • App::start_muse_subscription_login (cyclomatic 22) crates/jcode-tui/src/tui/app/auth/auth_muse.rs:198 — App::start_muse_subscription_login 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.
  • App::handle_copy_selection_mouse_with (cyclomatic 22) crates/jcode-tui/src/tui/app/copy_selection.rs:523 — App::handle_copy_selection_mouse_with 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.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×51
  • Duplicated block (11 lines × 2) crates/jcode-app-core/src/ambient/runner.rs:991 — crates/jcode-app-core/src/ambient/runner.rs:991-1001 | crates/jcode-app-core/src/ambient/runner.rs:1018-1028 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/comm_control.rs:1520 — crates/jcode-app-core/src/server/comm_control.rs:1520-1530 | crates/jcode-app-core/src/server/comm_plan.rs:528-538 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.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. 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/jcode-app-core/src/server/comm_plan.rs:282 — crates/jcode-app-core/src/server/comm_plan.rs:282-292 | crates/jcode-app-core/src/server/comm_plan.rs:302-312 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/jade_relay.rs:369 — crates/jcode-app-core/src/server/jade_relay.rs:369-379 | crates/jcode-app-core/src/server/jade_relay.rs:767-777 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/ambient.rs:361 — crates/jcode-app-core/src/tool/ambient.rs:361-371 | crates/jcode-app-core/src/tool/ambient.rs:896-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 (11 lines × 2) crates/jcode-app-core/src/tool/ambient.rs:423 — crates/jcode-app-core/src/tool/ambient.rs:423-433 | crates/jcode-tui-permissions/src/lib.rs:676-686 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/jcode-app-core/src/tool/bridge_reload.rs:129 — crates/jcode-app-core/src/tool/bridge_reload.rs:129-139 | crates/jcode-app-core/src/tool/desktop_selfdev.rs:331-341 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-app-core/src/tool/discover.rs:1182 — crates/jcode-app-core/src/tool/discover.rs:1182-1192 | crates/jcode-app-core/src/tool/discover.rs:1263-1273 — both copies are in the same file, so extract the block into 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/jcode-base/src/auth/codex.rs:541 — crates/jcode-base/src/auth/codex.rs:541-551 | crates/jcode-base/src/auth/codex.rs:554-564 — both copies are in the same file, so extract the block into 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/jcode-base/src/gmail.rs:297 — crates/jcode-base/src/gmail.rs:297-307 | crates/jcode-base/src/gmail.rs:429-439 — both copies are in the same file, so extract the block into 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/jcode-base/src/memory_prompt.rs:41 — crates/jcode-base/src/memory_prompt.rs:41-51 | crates/jcode-base/src/memory_prompt.rs:81-91 — both copies are in the same file, so extract the block into 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/jcode-harness-api/src/sockets.rs:54 — crates/jcode-harness-api/src/sockets.rs:54-64 | crates/jcode-storage/src/lib.rs:143-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-anthropic-runtime/src/lib.rs:274 — crates/jcode-provider-anthropic-runtime/src/lib.rs:274-284 | crates/jcode-provider-anthropic-runtime/src/lib.rs:298-308 — both copies are in the same file, so extract the block into 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/jcode-provider-anthropic-runtime/src/lib.rs:2377 — crates/jcode-provider-anthropic-runtime/src/lib.rs:2377-2387 | crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:265-275 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/jcode-provider-antigravity-runtime/src/lib.rs:465 — crates/jcode-provider-antigravity-runtime/src/lib.rs:465-475 | crates/jcode-provider-gemini-runtime/src/lib.rs:730-740 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/jcode-provider-antigravity/src/lib.rs:240 — crates/jcode-provider-antigravity/src/lib.rs:240-250 | crates/jcode-provider-gemini/src/lib.rs:602-612 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-env/src/lib.rs:108 — crates/jcode-provider-env/src/lib.rs:108-118 | crates/jcode-provider-env/src/lib.rs:194-204 — both copies are in the same file, so extract the block into 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/jcode-telemetry-core/src/lib.rs:1008 — crates/jcode-telemetry-core/src/lib.rs:1008-1018 | crates/jcode-telemetry-core/src/lib.rs:1029-1039 — both copies are in the same file, so extract the block into 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/jcode-telemetry-core/src/lifecycle.rs:176 — crates/jcode-telemetry-core/src/lifecycle.rs:176-186 | crates/jcode-usage-types/src/lib.rs:169-179 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-tui-core/src/keybind.rs:89 — crates/jcode-tui-core/src/keybind.rs:89-99 | crates/jcode-tui/src/tui/keybind.rs:615-625 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-tui-markdown/src/markdown_render_full.rs:50 — crates/jcode-tui-markdown/src/markdown_render_full.rs:50-60 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:33-43 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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/jcode-tui/src/tui/app.rs:2003 — crates/jcode-tui/src/tui/app.rs:2003-2013 | crates/jcode-tui/src/tui/app.rs:2058-2068 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:225 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:225-235 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:396-406 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/commands.rs:856 — crates/jcode-tui/src/tui/app/commands.rs:856-866 | crates/jcode-tui/src/tui/app/input.rs:2857-2867 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-tui/src/tui/app/commands_improve.rs:238 — crates/jcode-tui/src/tui/app/commands_improve.rs:238-248 | crates/jcode-tui/src/tui/app/commands_improve.rs:271-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 26 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×50
  • Duplicated block (5 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:840 — crates/jcode-app-core/src/server/client_actions.rs:840-847 | crates/jcode-app-core/src/server/client_actions.rs:885-889 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_swarm_write.rs:158 — crates/jcode-app-core/src/server/debug_swarm_write.rs:158-162 | crates/jcode-app-core/src/server/debug_swarm_write.rs:216-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) REDACTED:338 — REDACTED:338-342 | REDACTED:358-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-base/src/jev.rs:603 — crates/jcode-base/src/jev.rs:603-607 | crates/jcode-base/src/jev/laya.rs:76-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/jcode-base/src/todo.rs:505 — crates/jcode-base/src/todo.rs:505-509 | crates/jcode-base/src/todo.rs:510-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-embedding/src/lib.rs:192 — crates/jcode-embedding/src/lib.rs:192-197 | crates/jcode-embedding/src/lib.rs:266-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-provider-copilot-runtime/src/lib.rs:180 — crates/jcode-provider-copilot-runtime/src/lib.rs:180-184 | crates/jcode-provider-copilot-runtime/src/lib.rs:217-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:1046 — crates/jcode-provider-doctor/src/live_provider_probes.rs:1046-1050 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1823-1827 — both copies are in the same file, so extract the block into 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/jcode-provider-openai/src/request.rs:441 — crates/jcode-provider-openai/src/request.rs:441-447 | crates/jcode-provider-openrouter/src/request.rs:332-336 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:267 — crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:267-271 | crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:281-285 — both copies are in the same file, so extract the block into 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/jcode-tui-account-picker/src/overlay_render.rs:240 — crates/jcode-tui-account-picker/src/overlay_render.rs:240-244 | crates/jcode-tui/src/tui/login_picker.rs:621-625 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 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/jcode-tui-markdown/src/markdown_render_full.rs:22 — crates/jcode-tui-markdown/src/markdown_render_full.rs:22-26 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:8-12 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:103 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:103-107 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:130-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-tui-render/src/swarm_gallery.rs:450 — crates/jcode-tui-render/src/swarm_gallery.rs:450-458 | crates/jcode-tui-render/src/swarm_gallery.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/jcode-tui/src/tui/app/commands.rs:3198 — crates/jcode-tui/src/tui/app/commands.rs:3198-3202 | crates/jcode-tui/src/tui/app/commands.rs:3889-3893 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/commands_improve.rs:641 — crates/jcode-tui/src/tui/app/commands_improve.rs:641-645 | crates/jcode-tui/src/tui/app/commands_improve.rs:738-742 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/turn.rs:1647 — crates/jcode-tui/src/tui/app/turn.rs:1647-1651 | crates/jcode-tui/src/tui/app/turn.rs:1659-1663 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui_inline.rs:72 — crates/jcode-tui/src/tui/ui_inline.rs:72-77 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:654-658 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) src/bin/memory_recall_bench.rs:1193 — src/bin/memory_recall_bench.rs:1193-1197 | src/bin/memory_recall_bench.rs:1443-1447 — both copies are in the same file, so extract the block into 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) src/bin/memory_recall_bench.rs:1531 — src/bin/memory_recall_bench.rs:1531-1535 | src/bin/memory_recall_bench.rs:1671-1675 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/telemetry_state.rs:328 — crates/jcode-app-core/src/telemetry_state.rs:328-332 | crates/jcode-telemetry-core/src/state_support.rs:395-399 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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/jcode-app-core/src/telemetry_state.rs:334 — crates/jcode-app-core/src/telemetry_state.rs:334-338 | crates/jcode-telemetry-core/src/state_support.rs:401-405 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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/jcode-app-core/src/usage_openai.rs:236 — crates/jcode-app-core/src/usage_openai.rs:236-240 | crates/jcode-base/src/usage/openai_helpers.rs:250-254 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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/jcode-base/src/auth/mod.rs:198 — crates/jcode-base/src/auth/mod.rs:198-202 | crates/jcode-base/src/provider/models.rs:821-825 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/auth/refresh_state.rs:265 — crates/jcode-base/src/auth/refresh_state.rs:265-269 | crates/jcode-base/src/auth/validation.rs:24-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 25 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×43
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/notifications.rs:728 — crates/jcode-app-core/src/notifications.rs:728-739 | crates/jcode-setup-hints/src/cli_launch_hints.rs:352-363 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/server.rs:2246 — crates/jcode-app-core/src/server.rs:2246-2257 | crates/jcode-app-core/src/server.rs:2302-2313 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_jobs.rs:96 — crates/jcode-app-core/src/server/debug_jobs.rs:96-107 | crates/jcode-app-core/src/server/debug_jobs.rs:128-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/server/jade_relay.rs:1217 — crates/jcode-app-core/src/server/jade_relay.rs:1217-1228 | crates/jcode-app-core/src/server/jade_relay.rs:1248-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 (12 lines × 2) crates/jcode-app-core/src/server/runtime.rs:157 — crates/jcode-app-core/src/server/runtime.rs:157-168 | crates/jcode-app-core/src/server/runtime.rs:193-204 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/session_active_pids.rs:36 — crates/jcode-app-core/src/session_active_pids.rs:36-47 | crates/jcode-storage/src/active_pids.rs:205-216 — before extracting anything, compare `crates/jcode-app-core/src/session_active_pids.rs` and `crates/jcode-storage/src/active_pids.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:110 — crates/jcode-app-core/src/telemetry_state.rs:110-121 | crates/jcode-telemetry-core/src/state_support.rs:108-119 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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/jcode-app-core/src/telemetry_state.rs:267 — crates/jcode-app-core/src/telemetry_state.rs:267-278 | crates/jcode-telemetry-core/src/state_support.rs:310-321 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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:344 — REDACTED:344-355 | REDACTED:364-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/tool/communicate.rs:2113 — crates/jcode-app-core/src/tool/communicate.rs:2113-2124 | crates/jcode-app-core/src/tool/communicate.rs:2205-2216 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_openai.rs:205 — crates/jcode-app-core/src/usage_openai.rs:205-216 | crates/jcode-base/src/usage/openai_helpers.rs:219-230 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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/jcode-base/src/cache_tracker.rs:136 — crates/jcode-base/src/cache_tracker.rs:136-147 | crates/jcode-base/src/cache_tracker.rs:166-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/jcode-base/src/mcp/oauth.rs:553 — crates/jcode-base/src/mcp/oauth.rs:553-564 | crates/jcode-base/src/mcp/oauth.rs:1143-1156 — both copies are in the same file, so extract the block into 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/jcode-base/src/platform.rs:175 — crates/jcode-base/src/platform.rs:175-186 | crates/jcode-build-support/src/platform_support.rs:6-17 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-base/src/provider_catalog.rs:978 — crates/jcode-base/src/provider_catalog.rs:978-989 | crates/jcode-base/src/provider_catalog.rs:1115-1126 — both copies are in the same file, so extract the block into 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/jcode-base/src/safety.rs:224 — crates/jcode-base/src/safety.rs:224-235 | crates/jcode-base/src/safety.rs:455-466 — both copies are in the same file, so extract the block into 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/jcode-message-types/src/lib.rs:499 — crates/jcode-message-types/src/lib.rs:499-510 | crates/jcode-message-types/src/lib.rs:531-542 — both copies are in the same file, so extract the block into 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/jcode-provider-core/src/transport.rs:34 — crates/jcode-provider-core/src/transport.rs:34-45 | scripts/repro/tls-bad-record-mac/src/main.rs:27-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1094 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1094-1105 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1151-1162 — both copies are in the same file, so extract the block into 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/jcode-setup-hints/src/keymap/chord.rs:70 — crates/jcode-setup-hints/src/keymap/chord.rs:70-81 | crates/jcode-setup-hints/src/keymap/chord.rs:92-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/jcode-telemetry-core/src/lib.rs:2631 — crates/jcode-telemetry-core/src/lib.rs:2631-2642 | crates/jcode-telemetry-core/src/lib.rs:2644-2655 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/swarm_gallery.rs:1424 — crates/jcode-tui-render/src/swarm_gallery.rs:1424-1435 | crates/jcode-tui-render/src/swarm_gallery.rs:1520-1531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/jcode-tui-style/src/color.rs:312 — crates/jcode-tui-style/src/color.rs:312-323 | crates/jcode-tui-workspace/src/color_support.rs:274-285 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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/jcode-tui/src/tui/app/auth.rs:1301 — crates/jcode-tui/src/tui/app/auth.rs:1301-1312 | crates/jcode-tui/src/tui/app/auth.rs:1707-1718 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:289 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:289-300 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:335-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 18 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_base · ×41
  • jcode_base::session::render::render_messages_and_images_with_compacted_history (cyclomatic 40) crates/jcode-base/src/session/render.rs:344 — jcode_base::session::render::render_messages_and_images_with_compacted_history 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.
  • jcode_base::browser::ensure_browser_setup_for (cyclomatic 36) crates/jcode-base/src/browser.rs:270 — jcode_base::browser::ensure_browser_setup_for 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.
  • jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cyclomatic 33) crates/jcode-base/src/provider/catalog_remote_routes.rs:3 — jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback 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.
  • jcode_base::mcp::remote::streamable_post_inner (cyclomatic 30) crates/jcode-base/src/mcp/remote.rs:610 — jcode_base::mcp::remote::streamable_post_inner 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.
  • jcode_base::auth::transfer::import_cloud_inner (cyclomatic 29) crates/jcode-base/src/auth/transfer.rs:1016 — jcode_base::auth::transfer::import_cloud_inner 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.
  • jcode_base::provider_catalog::apply_named_provider_profile_env_from_config (cyclomatic 27) crates/jcode-base/src/provider_catalog.rs:930 — jcode_base::provider_catalog::apply_named_provider_profile_env_from_config has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: jcode_base::provider_catalog::openai_compatible_profile_static_models (cyclomatic 32) 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.
  • jcode_base::auth::login_diagnostics::classify_auth_failure_message (cyclomatic 26) crates/jcode-base/src/auth/login_diagnostics.rs:38 — jcode_base::auth::login_diagnostics::classify_auth_failure_message has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • jcode_base::usage::provider_fetch::fetch_openai_usage_for_account (cyclomatic 24) crates/jcode-base/src/usage/provider_fetch.rs:153 — jcode_base::usage::provider_fetch::fetch_openai_usage_for_account has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • jcode_base::mcp::oauth::www_authenticate_param (cyclomatic 23) crates/jcode-base/src/mcp/oauth.rs:655 — jcode_base::mcp::oauth::www_authenticate_param 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.
  • jcode_base::auth::assessment_for_key (cyclomatic 22) crates/jcode-base/src/auth/mod.rs:1130 — jcode_base::auth::assessment_for_key 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.
  • jcode_base::gateway::handle_ws_connection (cyclomatic 22) crates/jcode-base/src/gateway.rs:146 — jcode_base::gateway::handle_ws_connection 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.
  • jcode_base::import::import_codex_session_from_path (cyclomatic 22) crates/jcode-base/src/import.rs:1069 — jcode_base::import::import_codex_session_from_path 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.
  • jcode_base::usage::openai_helpers::parse_openai_usage_payload (cyclomatic 22) crates/jcode-base/src/usage/openai_helpers.rs:328 — jcode_base::usage::openai_helpers::parse_openai_usage_payload 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.
  • jcode_base::provider::catalog_routes::simplified_model_routes_for_picker (cyclomatic 21) crates/jcode-base/src/provider/catalog_routes.rs:24 — jcode_base::provider::catalog_routes::simplified_model_routes_for_picker 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.
  • jcode_base::usage::api_keys::fetch_compatible_profile_report (cyclomatic 21) crates/jcode-base/src/usage/api_keys.rs:213 — jcode_base::usage::api_keys::fetch_compatible_profile_report 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.
  • jcode_base::auth::doctor::recommended_actions (cyclomatic 20) crates/jcode-base/src/auth/doctor.rs:111 — jcode_base::auth::doctor::recommended_actions 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.
  • jcode_base::auth::lifecycle::route_matches_activation (cyclomatic 19) crates/jcode-base/src/auth/lifecycle.rs:903 — jcode_base::auth::lifecycle::route_matches_activation has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • jcode_base::goal::render_goal_detail (cyclomatic 19) crates/jcode-base/src/goal.rs:414 — jcode_base::goal::render_goal_detail 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.
  • jcode_base::provider_activity::source_key_for_provider_label (cyclomatic 19) crates/jcode-base/src/provider_activity.rs:314 — jcode_base::provider_activity::source_key_for_provider_label 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.
  • jcode_base::session::crash::find_crashed_legacy_scan (cyclomatic 19) crates/jcode-base/src/session/crash.rs:414 — jcode_base::session::crash::find_crashed_legacy_scan 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.
  • jcode_base::provider::catalog_routes::append_openai_routes (cyclomatic 18) crates/jcode-base/src/provider/catalog_routes.rs:515 — jcode_base::provider::catalog_routes::append_openai_routes 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.
  • jcode_base::transcript_sample::recent_external_transcripts_in (cyclomatic 18) crates/jcode-base/src/transcript_sample.rs:99 — jcode_base::transcript_sample::recent_external_transcripts_in 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.
  • jcode_base::kv_cache_monitor::reason (cyclomatic 17) crates/jcode-base/src/kv_cache_monitor.rs:559 — jcode_base::kv_cache_monitor::reason 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.
  • jcode_base::memory::pending::take_pending_memory_inner (cyclomatic 17) crates/jcode-base/src/memory/pending.rs:224 — jcode_base::memory::pending::take_pending_memory_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.
  • jcode_base::message::notifications::strip_ansi_escape_sequences (cyclomatic 17) crates/jcode-base/src/message/notifications.rs:12 — jcode_base::message::notifications::strip_ansi_escape_sequences has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (consume_escape, consume_string, consume_csi). 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.
  • + 16 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×40
  • Off the main sequence: jcode-agent-runtime — jcode-agent-runtime: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-ambient-types — jcode-ambient-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-applet-types — jcode-applet-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: jcode-auth-types — jcode-auth-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-background-types — jcode-background-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-command-risk — jcode-command-risk: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-config-types — jcode-config-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: jcode-core — jcode-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 13 project(s), so it's rigid to change.
  • Off the main sequence: jcode-desktop-open — jcode-desktop-open: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-embedding — jcode-embedding: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-gateway-types — jcode-gateway-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-import-core — jcode-import-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-memory-types — jcode-memory-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-message-types — jcode-message-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 24 project(s), so it's rigid to change.
  • Off the main sequence: jcode-notify-email — jcode-notify-email: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-overnight-core — jcode-overnight-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-plan — jcode-plan: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
  • Off the main sequence: jcode-provider-metadata — jcode-provider-metadata: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-schema-dialect — jcode-schema-dialect: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: jcode-selfdev-types — jcode-selfdev-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
  • Off the main sequence: jcode-side-panel-types — jcode-side-panel-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-task-types — jcode-task-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-terminal-image — jcode-terminal-image: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-terminal-launch — jcode-terminal-launch: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-tool-types — jcode-tool-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×39
  • Duplicated block (13 lines × 2) crates/jcode-app-core/src/message_notifications.rs:157 — crates/jcode-app-core/src/message_notifications.rs:157-169 | crates/jcode-base/src/message/notifications.rs:504-516 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/jcode-app-core/src/server.rs:996 — crates/jcode-app-core/src/server.rs:996-1008 | crates/jcode-app-core/src/server.rs:1096-1108 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_lifecycle.rs:780 — crates/jcode-app-core/src/server/client_lifecycle.rs:780-792 | crates/jcode-app-core/src/server/client_lifecycle.rs:920-932 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/jade_relay.rs:360 — crates/jcode-app-core/src/server/jade_relay.rs:360-372 | crates/jcode-app-core/src/server/jade_relay.rs:714-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) REDACTED:1294 — REDACTED:1294-1309 | REDACTED:1352-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.
  • Duplicated block (13 lines × 2) REDACTED:1325 — REDACTED:1325-1337 | REDACTED:1368-1380 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/discover.rs:1018 — crates/jcode-app-core/src/tool/discover.rs:1018-1030 | crates/jcode-app-core/src/tool/discover.rs:1209-1221 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_openai.rs:39 — crates/jcode-app-core/src/usage_openai.rs:39-51 | crates/jcode-base/src/usage/openai_helpers.rs:45-57 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/jcode-base/src/compaction.rs:432 — crates/jcode-base/src/compaction.rs:432-444 | crates/jcode-base/src/compaction.rs:1716-1728 — both copies are in the same file, so extract the block into 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/jcode-base/src/compaction.rs:1066 — crates/jcode-base/src/compaction.rs:1066-1078 | crates/jcode-base/src/compaction.rs:1082-1094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/jcode-base/src/memory_rerank.rs:277 — crates/jcode-base/src/memory_rerank.rs:277-289 | crates/jcode-base/src/memory_rerank.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/jcode-base/src/provider_catalog.rs:1000 — crates/jcode-base/src/provider_catalog.rs:1000-1012 | crates/jcode-base/src/provider_catalog.rs:1136-1148 — both copies are in the same file, so extract the block into 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/jcode-base/src/usage/accessors.rs:451 — crates/jcode-base/src/usage/accessors.rs:451-463 | crates/jcode-base/src/usage/accessors.rs:506-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/jcode-import-core/src/lib.rs:1105 — crates/jcode-import-core/src/lib.rs:1105-1117 | crates/jcode-session-types/src/lib.rs:622-634 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-provider-anthropic-runtime/src/lib.rs:1365 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1365-1377 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1825-1837 — both copies are in the same file, so extract the block into 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/jcode-provider-core/src/catalog_refresh.rs:60 — crates/jcode-provider-core/src/catalog_refresh.rs:60-72 | crates/jcode-provider-core/src/catalog_refresh.rs:74-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:264 — crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:264-276 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1264-1276 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-provider-openai/src/stream.rs:536 — crates/jcode-provider-openai/src/stream.rs:536-548 | crates/jcode-provider-openai/src/stream.rs:555-567 — both copies are in the same file, so extract the block into 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/jcode-tui-account-picker/src/overlay.rs:360 — crates/jcode-tui-account-picker/src/overlay.rs:360-372 | crates/jcode-tui/src/tui/login_picker.rs:249-261 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 202 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:266 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:266-278 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:514-526 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/lib.rs:87 — crates/jcode-tui-render/src/lib.rs:87-99 | crates/jcode-tui-render/src/lib.rs:137-149 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/swarm_gallery.rs:896 — crates/jcode-tui-render/src/swarm_gallery.rs:896-908 | crates/jcode-tui-render/src/swarm_gallery.rs:1240-1252 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/swarm_gallery.rs:1296 — crates/jcode-tui-render/src/swarm_gallery.rs:1296-1308 | crates/jcode-tui-render/src/swarm_gallery.rs:1394-1406 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/observe.rs:300 — crates/jcode-tui/src/tui/app/observe.rs:300-312 | crates/jcode-tui/src/tui/app/split_view.rs:315-327 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 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. 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/jcode-tui/src/tui/session_picker/loading.rs:2077 — crates/jcode-tui/src/tui/session_picker/loading.rs:2077-2089 | crates/jcode-tui/src/tui/session_picker/loading.rs:2257-2269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×38
  • Duplicated block (15 lines × 2) crates/jcode-app-core/src/agent/turn_execution.rs:1396 — crates/jcode-app-core/src/agent/turn_execution.rs:1396-1410 | src/cli/tui_launch.rs:31-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) crates/jcode-app-core/src/server/client_comm_context.rs:100 — crates/jcode-app-core/src/server/client_comm_context.rs:100-114 | crates/jcode-app-core/src/server/client_comm_message.rs:338-352 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-app-core/src/server/client_lifecycle.rs:1015 — crates/jcode-app-core/src/server/client_lifecycle.rs:1015-1029 | crates/jcode-app-core/src/server/client_lifecycle.rs:1265-1279 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_lifecycle.rs:1228 — crates/jcode-app-core/src/server/client_lifecycle.rs:1228-1242 | crates/jcode-app-core/src/server/client_lifecycle.rs:1348-1362 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_lifecycle.rs:3709 — crates/jcode-app-core/src/server/client_lifecycle.rs:3709-3723 | crates/jcode-app-core/src/server/client_lifecycle.rs:3819-3833 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/comm_plan.rs:381 — crates/jcode-app-core/src/server/comm_plan.rs:381-395 | crates/jcode-app-core/src/server/comm_plan.rs:619-633 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_display.rs:13 — crates/jcode-app-core/src/usage_display.rs:13-27 | crates/jcode-base/src/usage/display.rs:13-27 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 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/jcode-base/src/memory.rs:1231 — crates/jcode-base/src/memory.rs:1231-1245 | crates/jcode-base/src/memory.rs:1293-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/jcode-base/src/usage/api_keys.rs:704 — crates/jcode-base/src/usage/api_keys.rs:704-718 | crates/jcode-base/src/usage/api_keys.rs:742-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/jcode-command-risk/src/lib.rs:261 — crates/jcode-command-risk/src/lib.rs:261-275 | crates/jcode-command-risk/src/lib.rs:339-353 — both copies are in the same file, so extract the block into 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/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1535 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1535-1549 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2044-2058 — both copies are in the same file, so extract the block into 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/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:308 — crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:308-323 | crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:939-953 — both copies are in the same file, so extract the block into 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/jcode-render-core/src/preprocess.rs:84 — crates/jcode-render-core/src/preprocess.rs:84-98 | crates/jcode-render-core/src/preprocess.rs:157-171 — both copies are in the same file, so extract the block into 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/jcode-tui-mermaid/src/debug.rs:59 — crates/jcode-tui-mermaid/src/debug.rs:59-73 | crates/jcode-tui-mermaid/src/lib.rs:1619-1633 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-tui-style/src/color.rs:224 — crates/jcode-tui-style/src/color.rs:224-238 | crates/jcode-tui-workspace/src/color_support.rs:186-200 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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/jcode-tui-tool-display/src/lib.rs:121 — crates/jcode-tui-tool-display/src/lib.rs:121-135 | crates/jcode-tui/src/tui/ui_tools.rs:276-290 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/jcode-tui-tool-display/src/lib.rs:138 — crates/jcode-tui-tool-display/src/lib.rs:138-152 | crates/jcode-tui/src/tui/ui_tools.rs:293-307 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/jcode-tui/src/tui/app/auth_account_commands.rs:468 — crates/jcode-tui/src/tui/app/auth_account_commands.rs:468-482 | crates/jcode-tui/src/tui/app/auth_account_commands.rs:512-526 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/auth_account_commands.rs:484 — crates/jcode-tui/src/tui/app/auth_account_commands.rs:484-498 | crates/jcode-tui/src/tui/app/auth_account_commands.rs:528-542 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/commands.rs:1910 — crates/jcode-tui/src/tui/app/commands.rs:1910-1924 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1802-1816 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.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 (15 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:1977 — crates/jcode-tui/src/tui/app/commands.rs:1977-1991 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1957-1971 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.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 (15 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:2147 — crates/jcode-tui/src/tui/app/remote.rs:2147-2161 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:675-689 — before extracting anything, compare `crates/jcode-tui/src/tui/app/remote.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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/jcode-tui/src/tui/app/remote/reconnect.rs:649 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:649-663 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:686-700 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/redraw_schedule.rs:435 — crates/jcode-tui/src/tui/redraw_schedule.rs:435-449 | crates/jcode-tui/src/tui/redraw_schedule.rs:578-592 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui.rs:996 — crates/jcode-tui/src/tui/ui.rs:996-1010 | crates/jcode-tui/src/tui/ui.rs:1273-1287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 13 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×35
  • Repeated repair: crates/jcode-provider-openrouter-runtime/src/lib.rs crates/jcode-provider-openrouter-runtime/src/lib.rs:1345 — crates/jcode-provider-openrouter-runtime/src/lib.rs changed 39 times in last 90 days and 23 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 OpenRouterProvider::new_named_openai_compatible at line 1345), 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(ci): restore green master for v0.99.1”; “fix: apply Anthropic catalog authentication headers (fixes #1808)”; “fix(azure): require explicit reasoning effort”; “fix(azure): distinguish built-in and named routes”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-openrouter-runtime/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.
  • Repeated repair: REDACTED REDACTED:545 — REDACTED changed 10 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 jcode::cli::commands::menubar::macos::run_status_item_app at line 545), 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(menubar): stable macOS signing identity and a [menubar] enabled opt-out (#1793)”; “fix(menubar): draw the streaming icon green instead of tinting the template (#1785)”; “fix(menubar): gate passwd home helpers to macOS and unix tests”; “fix(ci): clear clippy 1.99 and macOS warning-budget failures”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -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.
  • Repeated repair: crates/jcode-tui/src/tui/ui_tests/mod.rs crates/jcode-tui/src/tui/ui_tests/mod.rs:162 — crates/jcode-tui/src/tui/ui_tests/mod.rs changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is TestState::justrust_status at line 162), 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: “Exercise expanded image geometry in cache reuse regression”; “Fix initial pinned todo updates hiding transcript prompts”; “fix(tui): repair reset review flow and show credit expirations”; “fix(tui): revert first-prompt jump to top”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/ui_tests/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/jcode-setup-hints/src/lib.rs crates/jcode-setup-hints/src/lib.rs:2000 — crates/jcode-setup-hints/src/lib.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 12 (its worst body is jcode_setup_hints::install_xfce_launch_hotkeys at line 2000), 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(ci): clear clippy 1.99 and macOS warning-budget failures”; “fix(macos): gate test-only and unused setup-hints imports”; “fix: persist prepared sessions and repair test/clippy drift”; “macos: hide notification helper, drop CLI Spotlight launcher; rustfmt fixes”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-setup-hints/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.
  • Repeated repair: crates/jcode-tui-mermaid/src/lib.rs crates/jcode-tui-mermaid/src/lib.rs:1571 — crates/jcode-tui-mermaid/src/lib.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 10 (its worst body is jcode_tui_mermaid::evict_old_cache at line 1571), 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 Kitty images in Zellij with classic placements”; “fix: persist prepared sessions and repair test/clippy drift”; “fix(tui): skip duplicate inline image sizes”; “fix(tui): invalidate mermaid message cache on resize”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui-mermaid/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.
  • Repeated repair: crates/jcode-base/src/sidecar.rs crates/jcode-base/src/sidecar.rs:995 — crates/jcode-base/src/sidecar.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 10 (its worst body is jcode_base::sidecar::collect_openai_sse_text at line 995), 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(provider): retain observed usage on simple completion failures”; “fix(usage): retain sparse cache reports and served sidecar models”; “fix: update Claude OAuth client version (#1135)”; “fix(memory): preserve provider route and omit metadata”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/sidecar.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/jcode-base/src/subscription_catalog.rs crates/jcode-base/src/subscription_catalog.rs:84 — crates/jcode-base/src/subscription_catalog.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 JcodeTier::parse at line 84), 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(subscription): accept deployed Sonnet 4.6 model ID”; “fix(subscription): restrict catalog to Claude 5.5 and GPT 6.1”; “fix: make env files the source of truth for API keys”; “fix: unblock SDK 1.2.0 runtime refresh (#842)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/subscription_catalog.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/jcode-message-types/src/lib.rs crates/jcode-message-types/src/lib.rs:484 — crates/jcode-message-types/src/lib.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 11 (its worst body is jcode_message_types::ends_with_fresh_user_turn at line 484), 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: apply speed tier changes promptly with truthful provider feedback”; “fix(openai): render native web citations from URL annotations”; “fix(agent): keep non-object streamed tool arguments so malformed calls get corrected”; “fix: persist prepared sessions and repair test/clippy drift”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-message-types/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.
  • Repeated repair: crates/jcode-provider-gemini/src/lib.rs crates/jcode-provider-gemini/src/lib.rs:287 — crates/jcode-provider-gemini/src/lib.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is jcode_provider_gemini::build_contents_with_signature_policy at line 287), 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(gemini): account for explicit tool-use prompt tokens”; “fix(gemini): include thinking tokens in output usage”; “fix(gemini): default to non-dated gemini-pro-latest alias”; “fix: sanitize Gemini schemas and MCP notifications (fixes #754)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-gemini/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.
  • Repeated repair: crates/jcode-base/src/skill.rs crates/jcode-base/src/skill.rs:113 — crates/jcode-base/src/skill.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is SkillRegistry::import_from_external at line 113), 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: skip skills already imported by an earlier source on first run (fixes #1404) (#1416)”; “fix: accept list-style skill allowed-tools (fixes #1041)”; “fix: report malformed skill files (fixes #952)”; “fix: drop three stale files this branch dragged in from a dirty worktree”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/skill.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/jcode-tui/src/tui/mermaid.rs crates/jcode-tui/src/tui/mermaid.rs:44 — crates/jcode-tui/src/tui/mermaid.rs changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is jcode_tui::tui::mermaid::install_jcode_mermaid_hooks at line 44), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix Kitty images in Zellij with classic placements”; “fix(tui): skip duplicate inline image sizes”; “fix(tui): invalidate mermaid message cache on resize”; “fix(tui): apply resize clicks to mermaid placeholders”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui/src/tui/mermaid.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/jcode-base/src/terminal_launch.rs crates/jcode-base/src/terminal_launch.rs:47 — crates/jcode-base/src/terminal_launch.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is jcode_base::terminal_launch::try_spawn_via_companion at line 47), 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: unblock SDK 1.2.0 runtime refresh (#842)”; “fix: fall back when spawn hooks reject launch (fixes #792)”; “fix: support composable client hooks (fixes #759)”; “fix(test): make the #715 launcher test deterministic”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/terminal_launch.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/jcode-base/src/provider/pricing.rs crates/jcode-base/src/provider/pricing.rs:304 — crates/jcode-base/src/provider/pricing.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is jcode_base::provider::pricing::cheapness_for_route at line 304), 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(pricing): keep local profiles out of the cross-provider fallback (follow-up to #1658)”; “fix: make env files the source of truth for API keys”; “fix(session): persist sessions created with a title before the first visible message (fixes #1144)”; “fix(openrouter): price @endpoint-pinned models from the pinned endpoint (fixes #1095)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/provider/pricing.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/jcode-tui-mermaid/src/mermaid_content.rs crates/jcode-tui-mermaid/src/mermaid_content.rs:409 — crates/jcode-tui-mermaid/src/mermaid_content.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is jcode_tui_mermaid::mermaid_content::write_video_export_marker at line 409), 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: persist prepared sessions and repair test/clippy drift”; “fix(tui): skip duplicate inline image sizes”; “fix(tui): apply resize clicks to mermaid placeholders”; “fix(tui): resize and copy clicked mermaid diagrams”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui-mermaid/src/mermaid_content.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/jcode-provider-openai-runtime/src/openai_websocket_prewarm.rs crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.rs:274 — crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is jcode_provider_openai_runtime::openai_websocket_prewarm::warm_socket at line 274), 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(openai): avoid replaying response output in websocket deltas”; “fix(openai): send route-specific speed tier headers and rebind sockets”; “fix(openai): preserve session cache affinity across transports”; “fix(openai): replay changed persistent input prefixes”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.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/jcode-provider-antigravity/src/lib.rs crates/jcode-provider-antigravity/src/lib.rs:627 — crates/jcode-provider-antigravity/src/lib.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is jcode_provider_antigravity::flatten_schema_combiners at line 627), 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(antigravity): address greptile review — override-aware project lookup, endpoint validation, catalog invalidation”; “fix(antigravity): use daily-cloudcode-pa endpoint to fix consumer-account 429s”; “fix(antigravity): reject imitated tool calls”; “fix: sanitize Gemini schemas and MCP notifications (fixes #754)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-antigravity/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.
  • Repeated repair: crates/jcode-app-core/src/server/account_usage.rs crates/jcode-app-core/src/server/account_usage.rs:111 — crates/jcode-app-core/src/server/account_usage.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is jcode_app_core::server::account_usage::wire_snapshot at line 111), 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): stabilize startup layout and hydrate daemon quota hints”; “fix(usage): retain adaptive polling and mark last-known quotas stale”; “fix(usage): share daemon Claude snapshots and clarify lookup failures”; “fix(usage): fetch account router quotas on daemon in background”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/server/account_usage.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: telemetry-worker/scripts/sync-model-prices.mjs telemetry-worker/scripts/sync-model-prices.mjs:83 — telemetry-worker/scripts/sync-model-prices.mjs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is sync-model-prices.main at line 83), 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(telemetry): discover canonical usage prices and document replay limits”; “fix(telemetry): estimate prices for new model releases before models.dev lists them”; “fix(telemetry): price new models nightly so spend stops reading $0 for Opus 5.5”; “fix(telemetry): report unmatched model pricing coverage across providers”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- telemetry-worker/scripts/sync-model-prices.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/jcode-tui-mermaid/src/mermaid_runtime.rs crates/jcode-tui-mermaid/src/mermaid_runtime.rs:248 — crates/jcode-tui-mermaid/src/mermaid_runtime.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_tui_mermaid::mermaid_runtime::infer_protocol_from_env at line 248), 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 Kitty images in Zellij with classic placements”; “fix(mermaid): detect foot as a sixel terminal”; “fix: preserve Mermaid diagrams in native tmux sixel (fixes #1051)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-tui-mermaid/src/mermaid_runtime.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/jcode-schema-dialect/src/registry.rs crates/jcode-schema-dialect/src/registry.rs:254 — crates/jcode-schema-dialect/src/registry.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is jcode_schema_dialect::registry::by_id at line 254), 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(gemini): present Gemini CLI client identity and flatten root anyOf for Code Assist”; “refactor(anthropic): run the dialect engine, and fix the dialect it exposed”; “fix(schema): Antigravity's non-Gemini routes still speak the Gemini payload”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-schema-dialect/src/registry.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/jcode-base/src/usage/accessors.rs crates/jcode-base/src/usage/accessors.rs:181 — crates/jcode-base/src/usage/accessors.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is jcode_base::usage::accessors::get_openai_usage_for_label_sync at line 181), 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(usage): coalesce Anthropic probes across processes and preserve backoff”; “fix(usage): scope OpenAI widget snapshots to OAuth email”; “fix(anthropic): reroute exhausted Fable quota to Opus”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/usage/accessors.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/jcode-provider-core/src/fallback_pick.rs crates/jcode-provider-core/src/fallback_pick.rs:447 — crates/jcode-provider-core/src/fallback_pick.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_provider_core::fallback_pick::rank_fallback_routes at line 447), 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(failover): prefer latest-generation model and auto-switch from unlabeled OAuth”; “fix(tui): stop retrying permanently rejected OAuth sessions”; “fix(provider): serialize Grok Build SetRoute switches”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-provider-core/src/fallback_pick.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/jcode-app-core/src/notifications.rs crates/jcode-app-core/src/notifications.rs:790 — crates/jcode-app-core/src/notifications.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_app_core::notifications::imap_reply_loop 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: “macos: hide notification helper, drop CLI Spotlight launcher; rustfmt fixes”; “fix: reap notification children without blocking callers (fixes #1187)”; “fix: unblock SDK 1.2.0 runtime refresh (#842)”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-app-core/src/notifications.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/jcode-schema-dialect/src/lib.rs crates/jcode-schema-dialect/src/lib.rs:84 — crates/jcode-schema-dialect/src/lib.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is jcode_schema_dialect::recover_from_error at line 84), 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 todo add schema rejected by Gemini”; “fix(openai): stop claiming strict for a schema OpenAI rejects (fixes #713)”; “fix(schema): learn every keyword a 400 names, not just the first”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-schema-dialect/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.
  • Repeated repair: crates/jcode-base/src/auth/muse.rs crates/jcode-base/src/auth/muse.rs:529 — crates/jcode-base/src/auth/muse.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_base::auth::muse::poll_login_by_code at line 529), 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(ci): restore green master for v0.99.1”; “fix(muse): send a User-Agent so device authorization is reachable”; “fix(muse): make cancellation and attempt ownership authoritative”. 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-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 17:29:49 -07:00' --until='2026-10-26 17:29:49 -07:00' --full-history --no-merges -- crates/jcode-base/src/auth/muse.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.
  • + 10 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode · ×34
  • jcode::bin::memory_recall_bench::cmd_metrics (cyclomatic 92) src/bin/memory_recall_bench.rs:1014 — jcode::bin::memory_recall_bench::cmd_metrics has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode::cli::dispatch::run_main (cyclomatic 78) src/cli/dispatch.rs:74 — jcode::cli::dispatch::run_main has cyclomatic complexity 78 (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.
  • jcode::cli::provider_init::init_provider_with_model_policy (cyclomatic 56) src/cli/provider_init.rs:1525 — jcode::cli::provider_init::init_provider_with_model_policy has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ProviderChoice::as_arg_value (cyclomatic 57) 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.
  • jcode::cli::tui_launch::list_sessions (cyclomatic 51) src/cli/tui_launch.rs:499 — jcode::cli::tui_launch::list_sessions has cyclomatic complexity 51 (threshold 15). Of this number, 41 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode::cli::commands::run_memory_command_for_dir (cyclomatic 48) src/cli/commands.rs:1615 — jcode::cli::commands::run_memory_command_for_dir 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.
  • jcode::bin::memory_recall_bench::cmd_gate (cyclomatic 46) src/bin/memory_recall_bench.rs:2189 — jcode::bin::memory_recall_bench::cmd_gate 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.
  • jcode::cli::proctitle::initial_title (cyclomatic 46) src/cli/proctitle.rs:11 — jcode::cli::proctitle::initial_title has cyclomatic complexity 46 (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.
  • jcode::bin::tui_bench::main (cyclomatic 45) src/bin/tui_bench.rs:1212 — jcode::bin::tui_bench::main has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode::cli::cloud_move::run_cli (cyclomatic 38) src/cli/cloud_move.rs:2304 — jcode::cli::cloud_move::run_cli has cyclomatic complexity 38 (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.
  • jcode::cli::login::run_login_provider (cyclomatic 38) src/cli/login.rs:258 — jcode::cli::login::run_login_provider has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode::cli::cloud_group_run::run_migrate (cyclomatic 32) src/cli/cloud_group_run.rs:3 — jcode::cli::cloud_group_run::run_migrate 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.
  • jcode::cli::cloud_move::run_move (cyclomatic 30) src/cli/cloud_move.rs:846 — jcode::cli::cloud_move::run_move 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.
  • jcode::cli::dispatch::run_default_command (cyclomatic 27) src/cli/dispatch.rs:788 — jcode::cli::dispatch::run_default_command 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.
  • jcode::cli::login::login_openai_compatible_flow (cyclomatic 24) src/cli/login.rs:843 — jcode::cli::login::login_openai_compatible_flow 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.
  • jcode::cli::cloud_group_receive::activate (cyclomatic 23) src/cli/cloud_group_receive.rs:61 — jcode::cli::cloud_group_receive::activate 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.
  • jcode::cli::commands::run_server_stop_command (cyclomatic 23) src/cli/commands.rs:2455 — jcode::cli::commands::run_server_stop_command 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.
  • jcode::cli::commands::prepare_run_todo_follow_up (cyclomatic 23) src/cli/commands.rs:2968 — jcode::cli::commands::prepare_run_todo_follow_up 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.
  • jcode::cli::commands::run_single_message_command_ndjson (cyclomatic 23) src/cli/commands.rs:3467 — jcode::cli::commands::run_single_message_command_ndjson 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.
  • jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session (cyclomatic 21) src/bin/tui_bench.rs:659 — jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session 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.
  • jcode::cli::commands::run_cloud_sessions_sync (cyclomatic 21) src/cli/commands.rs:626 — jcode::cli::commands::run_cloud_sessions_sync 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. This is NOT this file's highest cyclomatic complexity: jcode::cli::commands::emit_ndjson_event (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 function is counted neither in this dimension's figures nor in its score.
  • jcode::cli::commands::provider_setup::configure_provider_profile (cyclomatic 21) src/cli/commands/provider_setup.rs:92 — jcode::cli::commands::provider_setup::configure_provider_profile 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.
  • jcode::cli::tui_launch::run_tui_client (cyclomatic 21) src/cli/tui_launch.rs:84 — jcode::cli::tui_launch::run_tui_client 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.
  • jcode::cli::selfdev::run_self_dev (cyclomatic 20) src/cli/selfdev.rs:101 — jcode::cli::selfdev::run_self_dev 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.
  • jcode::cli::cloud_env::exchange_bounded (cyclomatic 19) src/cli/cloud_env.rs:137 — jcode::cli::cloud_env::exchange_bounded 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.
  • jcode::cli::commands::run_browser (cyclomatic 19) src/cli/commands.rs:1963 — jcode::cli::commands::run_browser 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: jcode::cli::commands::emit_ndjson_event (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 function is counted neither in this dimension's figures nor in its score.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×33
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1111 — crates/jcode-app-core/src/server/client_lifecycle.rs:1111-1124 | crates/jcode-app-core/src/server/client_lifecycle.rs:1132-1145 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_display.rs:73 — crates/jcode-app-core/src/usage_display.rs:73-86 | crates/jcode-base/src/usage/display.rs:77-90 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/usage_openai.rs:288 — crates/jcode-app-core/src/usage_openai.rs:288-301 | crates/jcode-base/src/usage/openai_helpers.rs:302-315 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-base/src/auth/transfer.rs:370 — crates/jcode-base/src/auth/transfer.rs:370-383 | crates/jcode-base/src/auth/transfer.rs:1190-1203 — both copies are in the same file, so extract the block into 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/jcode-base/src/client_input.rs:36 — crates/jcode-base/src/client_input.rs:36-49 | crates/jcode-tui/src/tui/app/state_ui.rs:387-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) crates/jcode-base/src/import.rs:1135 — crates/jcode-base/src/import.rs:1135-1148 | crates/jcode-import-core/src/lib.rs:683-696 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-base/src/provider/models.rs:675 — crates/jcode-base/src/provider/models.rs:675-688 | crates/jcode-base/src/provider/models.rs:711-724 — both copies are in the same file, so extract the block into 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/jcode-base/src/provider/openrouter.rs:220 — crates/jcode-base/src/provider/openrouter.rs:220-233 | crates/jcode-provider-openrouter-runtime/src/lib.rs:305-318 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-base/src/provider_activity.rs:136 — crates/jcode-base/src/provider_activity.rs:136-149 | crates/jcode-base/src/provider_activity.rs:213-226 — both copies are in the same file, so extract the block into 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/jcode-compaction-core/src/lib.rs:283 — crates/jcode-compaction-core/src/lib.rs:283-296 | crates/jcode-compaction-core/src/lib.rs:306-319 — both copies are in the same file, so extract the block into 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/jcode-provider-anthropic-runtime/src/lib.rs:2045 — crates/jcode-provider-anthropic-runtime/src/lib.rs:2045-2058 | crates/jcode-provider-anthropic-runtime/src/lib.rs:2077-2090 — both copies are in the same file, so extract the block into 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/jcode-provider-cursor-runtime/src/agent_transport.rs:638 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:638-651 | crates/jcode-provider-cursor-runtime/src/wire.rs:76-89 — before extracting anything, compare `crates/jcode-provider-cursor-runtime/src/agent_transport.rs` and `crates/jcode-provider-cursor-runtime/src/wire.rs` as WHOLE FILES: this scan already matched 4 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. 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/jcode-provider-openai/src/stream.rs:1117 — crates/jcode-provider-openai/src/stream.rs:1117-1130 | crates/jcode-provider-openrouter/src/stream.rs:542-555 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-swarm-core/src/lib.rs:282 — crates/jcode-swarm-core/src/lib.rs:282-295 | crates/jcode-swarm-core/src/lib.rs:304-317 — both copies are in the same file, so extract the block into 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/jcode-tui-account-picker/src/overlay.rs:583 — crates/jcode-tui-account-picker/src/overlay.rs:583-596 | crates/jcode-tui/src/tui/login_picker.rs:476-489 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 202 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-tui-anim/src/lib.rs:438 — crates/jcode-tui-anim/src/lib.rs:438-451 | crates/jcode-tui-anim/src/lib.rs:460-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 (14 lines × 2) crates/jcode-tui-usage-overlay/src/lib.rs:460 — crates/jcode-tui-usage-overlay/src/lib.rs:460-473 | crates/jcode-tui/src/tui/login_picker.rs:366-379 — before extracting anything, compare `crates/jcode-tui-usage-overlay/src/lib.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 198 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/jcode-tui/src/tui/app/auth_account_commands.rs:36 — crates/jcode-tui/src/tui/app/auth_account_commands.rs:36-49 | crates/jcode-tui/src/tui/app/auth_account_commands.rs:61-74 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/inline_interactive.rs:1298 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1298-1311 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1400-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 (14 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:2476 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:2476-2489 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:2632-2645 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/turn.rs:909 — crates/jcode-tui/src/tui/app/turn.rs:909-922 | crates/jcode-tui/src/tui/app/turn.rs:1211-1224 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/info_widget_usage.rs:113 — crates/jcode-tui/src/tui/info_widget_usage.rs:113-126 | crates/jcode-tui/src/tui/info_widget_usage.rs:263-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/jcode-tui/src/tui/mod.rs:1726 — crates/jcode-tui/src/tui/mod.rs:1726-1739 | crates/jcode-tui/src/tui/mod.rs:1741-1754 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/session_picker.rs:1983 — crates/jcode-tui/src/tui/session_picker.rs:1983-1996 | crates/jcode-tui/src/tui/session_picker.rs:2001-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 (14 lines × 2) crates/jcode-tui/src/tui/ui.rs:1177 — crates/jcode-tui/src/tui/ui.rs:1177-1190 | crates/jcode-tui/src/tui/ui.rs:1310-1323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 8 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×31
  • ClassTooLong: BridgeState crates/jcode-harness-api-server/src/translate.rs:118 — ClassTooLong — 2318 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 57 methods, 3 blocks, lines 118-3612. The bar is 400 significant lines; this is 1918 over it, 5.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MultiProvider crates/jcode-base/src/provider/mod.rs:384 — ClassTooLong — 1842 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, 4 blocks, lines 384-3067. The bar is 400 significant lines; this is 1442 over it, 4.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:278 — ClassTooLong — 1580 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 109 methods, 2 blocks, lines 278-2655. The bar is 400 significant lines; this is 1180 over it, 3.95× 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: OpenRouterProvider crates/jcode-provider-openrouter-runtime/src/lib.rs:825 — ClassTooLong — 1303 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 78 methods, 2 blocks, lines 825-2843. The bar is 400 significant lines; this is 903 over it, 3.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: Server crates/jcode-app-core/src/server.rs:752 — ClassTooLong — 1275 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 2 blocks, lines 752-2629. The bar is 400 significant lines; this is 875 over it, 3.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: App crates/jcode-tui/src/tui/app.rs:965 — ClassTooLong — 1174 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 969 methods, 2 blocks, lines 965-2957. The bar is 400 significant lines; this is 774 over it, 2.94× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BackgroundTaskManager crates/jcode-base/src/background.rs:36 — ClassTooLong — 1151 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 3 blocks, lines 36-1716. The bar is 400 significant lines; this is 751 over it, 2.88× 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: BedrockProvider crates/jcode-provider-bedrock/src/lib.rs:96 — ClassTooLong — 1100 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 4 blocks, lines 96-1609. The bar is 400 significant lines; this is 700 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: Registry crates/jcode-app-core/src/tool/mod.rs:304 — ClassTooLong — 1056 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 304-1919. The bar is 400 significant lines; this is 656 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Session crates/jcode-base/src/session.rs:120 — ClassTooLong — 1028 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 96 methods, 2 blocks, lines 120-1721. The bar is 400 significant lines; this is 628 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CommunicateTool crates/jcode-app-core/src/tool/communicate.rs:1654 — ClassTooLong — 910 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 3 blocks, lines 1654-3146. The bar is 400 significant lines; this is 510 over it, 2.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CompactionManager crates/jcode-base/src/compaction.rs:135 — ClassTooLong — 895 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 61 methods, 3 blocks, lines 135-1700. The bar is 400 significant lines; this is 495 over it, 2.24× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MemoryManager crates/jcode-base/src/memory.rs:184 — ClassTooLong — 862 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 61 methods, 3 blocks, lines 184-1568. The bar is 400 significant lines; this is 462 over it, 2.16× 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: JcodeClient crates/jcode-sdk/src/client.rs:353 — ClassTooLong — 825 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 74 methods, 4 blocks, lines 353-1614. The bar is 400 significant lines; this is 425 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: Agent crates/jcode-app-core/src/agent.rs:319 — ClassTooLong — 812 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 269 methods, 3 blocks, lines 139-1395. The bar is 400 significant lines; this is 412 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: AcpRuntime src/cli/acp.rs:300 — 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), 24 methods, 2 blocks, lines 300-1364. 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: CopilotApiProvider crates/jcode-provider-copilot-runtime/src/lib.rs:44 — ClassTooLong — 791 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 31 methods, 3 blocks, lines 44-1197. The bar is 400 significant lines; this is 391 over it, 1.98× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: JcodeClient sdk/typescript/src/client.ts:223 — ClassTooLong — 758 significant lines (blank, comment-only and punctuation-only lines excluded), 73 methods. The bar is 400 significant lines; this is 358 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GeminiProvider crates/jcode-provider-gemini-runtime/src/lib.rs:42 — ClassTooLong — 755 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 5 blocks, lines 42-1161. The bar is 400 significant lines; this is 355 over it, 1.89× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AmbientRunnerHandle crates/jcode-app-core/src/ambient/runner.rs:39 — ClassTooLong — 722 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, 2 blocks, lines 39-1132. The bar is 400 significant lines; this is 322 over it, 1.81× 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: AntigravityProvider crates/jcode-provider-antigravity-runtime/src/lib.rs:35 — ClassTooLong — 586 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 5 blocks, lines 35-941. The bar is 400 significant lines; this is 186 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AccountPicker crates/jcode-tui-account-picker/src/overlay.rs:30 — ClassTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 2 blocks, lines 30-831. The bar is 400 significant lines; this is 176 over it, 1.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: OpenAIProvider crates/jcode-provider-openai-runtime/src/lib.rs:706 — ClassTooLong — 570 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, 2 blocks, lines 706-1563. The bar is 400 significant lines; this is 170 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.
  • ClassTooLong: ServerEvent crates/jcode-protocol/src/wire/events.rs:70 — ClassTooLong — 548 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods. The bar is 400 significant lines; this is 148 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GmailTool crates/jcode-app-core/src/tool/gmail.rs:9 — ClassTooLong — 514 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 3 blocks, lines 9-760. The bar is 400 significant lines; this is 114 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 6 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×28
  • Change coupling: markdown_render_full.rs ↔ markdown_render_lazy.rs crates/jcode-tui-markdown/src/markdown_render_full.rs:1 — `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` change together 95% of the time (18 of the 19 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `a6eab991` fix(tui): keep blockquote gutters continuous across paragraph breaks; `6e0234af` fix(tui): keep blockquote gutters continuous across paragraph breaks; `63df3106` render display math images inside lists — run `git show` on any of them.
  • Change coupling: comm_session.rs ↔ debug_session_admin.rs crates/jcode-app-core/src/server/comm_session.rs:1 — `crates/jcode-app-core/src/server/comm_session.rs` and `crates/jcode-app-core/src/server/debug_session_admin.rs` change together 88% of the time (15 of the 17 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `d3303bad` refactor(swarm): make the headless memory scope a named choice (refs …; `3f384a6e` refactor(swarm): make the headless memory scope a named choice (refs …; `3e855091` fix(swarm): spawned workers keep real memory instead of test storage … — run `git show` on any of them.
  • Change coupling: REDACTED ↔ dispatch.rs src/cli/args/tests.rs:1 — `src/cli/args/tests.rs` and `src/cli/dispatch.rs` change together 82% of the time (33 of the 40 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 33 shared commits counted here, the most recent 3 are `61d871c1` Add opt-in v1 preview update channel; `7f52d118` google: guided OAuth app setup like gog, plus auto-import and publish…; `a8869dc0` google: selectable services in Google login and a built-in calendar tool — run `git show` on any of them.
  • Change coupling: display_summary.rs ↔ lib.rs crates/jcode-base/src/config/display_summary.rs:1 — `crates/jcode-base/src/config/display_summary.rs` and `crates/jcode-config-types/src/lib.rs` change together 73% of the time (22 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 22 shared commits counted here, the most recent 3 are `fc34ea46` tui: Alt+Up/Down cycle speed tier (Standard, Fast, Ultrafast); `e5e42854` Remove pinned diff side panel mode; `2e6e4232` Replace automatic memory recall with embedding-free Jev decisions — run `git show` on any of them.
  • Change coupling: client_api.rs ↔ backend.rs crates/jcode-app-core/src/server/client_api.rs:1 — `crates/jcode-app-core/src/server/client_api.rs` and `crates/jcode-tui/src/tui/backend.rs` change together 73% of the time (19 of the 26 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 19 shared commits counted here, the most recent 3 are `753f0d10` feat(router): server-side account failover for Desktop/SDK clients; `cfbf3d9e` fix(protocol): wire disconnect crash flag; `2882928a` fix(protocol): wire disconnect crash flag — run `git show` on any of them.
  • Change coupling: accessors.rs ↔ external.rs crates/jcode-base/src/provider/accessors.rs:1 — `crates/jcode-base/src/provider/accessors.rs` and `crates/jcode-base/src/provider/external.rs` change together 73% of the time (8 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `3e4f0933` refactor(providers): remove the Claude Code CLI subprocess transport; `3d187f4a` refactor(provider): move OpenRouter runtime out of jcode-base into do…; `a8faf98f` refactor(provider): move Anthropic runtime out of jcode-base (base wi… — run `git show` on any of them.
  • Change coupling: core_events.rs ↔ server_events.rs crates/jcode-app-core/src/protocol_tests/core_events.rs:1 — `crates/jcode-app-core/src/protocol_tests/core_events.rs` and `crates/jcode-tui/src/tui/app/remote/server_events.rs` change together 69% of the time (9 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 9 shared commits counted here, the most recent 3 are `5d20e9cc` fix(usage): report authoritative OAuth account to remote clients; `8ef93821` Track per-request cache prompt totals across providers and history; `827eee1c` feat(sdk): expose durable per-turn history response stats — run `git show` on any of them.
  • Change coupling: lib.rs ↔ lib.rs crates/jcode-harness-api/src/lib.rs:1 — `crates/jcode-harness-api/src/lib.rs` and `crates/jcode-sdk/src/lib.rs` change together 68% of the time (15 of the 22 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 15 shared commits counted here, the most recent 3 are `2f703919` Expose native runtime commands through harness and SDK; `adbf48bd` feat(sdk): expose structured abnormal turn stop reasons; `9a7be7be` fix(protocol): frame assistant text messages and preserve retry corre… — run `git show` on any of them.
  • Change coupling: REDACTED ↔ bg.rs REDACTED:1 — `REDACTED` and `crates/jcode-app-core/src/tool/bg.rs` change together 67% of the time (12 of the 18 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `bc0e25de` feat(bg): stall watchdog wakes the agent when a background task goes …; `b861f370` feat(bg): stall watchdog wakes the agent when a background task goes …; `039dc86a` Cap tool parameter descriptions at ~25 tokens — run `git show` on any of them.
  • Change coupling: client_comm_context.rs ↔ input_format.rs crates/jcode-app-core/src/server/client_comm_context.rs:1 — `crates/jcode-app-core/src/server/client_comm_context.rs` and `crates/jcode-app-core/src/tool/communicate_tests/input_format.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 `e2ad1db3` swarm: add stalled-worker watchdog (#1703); `b9cb0aaf` feat(swarm): add agents.swarm_effort pin and show worker effort in sw…; `d7d5d8ad` feat(swarm): add agents.swarm_effort pin and show worker effort in sw… — run `git show` on any of them.
  • Change coupling: core_events.rs ↔ server_events.rs crates/jcode-protocol/src/protocol_tests/core_events.rs:1 — `crates/jcode-protocol/src/protocol_tests/core_events.rs` and `crates/jcode-tui/src/tui/app/remote/server_events.rs` change together 60% of the time (15 of the 25 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 15 shared commits counted here, the most recent 3 are `4be17b27` Delta History: also skip rendered images the client already holds; `5d20e9cc` fix(usage): report authoritative OAuth account to remote clients; `8ef93821` Track per-request cache prompt totals across providers and history — run `git show` on any of them.
  • Change coupling: REDACTED ↔ proctitle.rs src/cli/args/tests.rs:1 — `src/cli/args/tests.rs` and `src/cli/proctitle.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 `61d871c1` Add opt-in v1 preview update channel; `6fa94a88` fix: honor telemetry opt-out before install event (fixes #893); `0f675d89` fix: honor telemetry opt-out before install event (fixes #893) — run `git show` on any of them.
  • Change coupling: info_widget_tips.rs ↔ ui_overlays.rs crates/jcode-tui/src/tui/info_widget_tips.rs:1 — `crates/jcode-tui/src/tui/info_widget_tips.rs` and `crates/jcode-tui/src/tui/ui_overlays.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `35b06b58` tui: Alt+G opens the project's git commit log; diff cycling moves to …; `73913b0a` tui: show ⌥ instead of Alt in keybinding hints on macOS; `ad05593e` tui: show ⌥ instead of Alt in keybinding hints on macOS — run `git show` on any of them.
  • Change coupling: env_overrides.rs ↔ hooks.rs crates/jcode-base/src/config/env_overrides.rs:1 — `crates/jcode-base/src/config/env_overrides.rs` and `crates/jcode-base/src/hooks.rs` change together 59% of the time (10 of the 17 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 `dd86f266` hooks: expose tool input, call id, touched paths to post_tool; add po…; `75dd137b` feat: add pre-tool input transformers (#1279); `774c2254` Revert "Merge PR #758" — run `git show` on any of them.
  • Change coupling: hooks.rs ↔ lib.rs crates/jcode-base/src/hooks.rs:1 — `crates/jcode-base/src/hooks.rs` and `crates/jcode-config-types/src/lib.rs` change together 59% of the time (10 of the 17 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 `dd86f266` hooks: expose tool input, call id, touched paths to post_tool; add po…; `75dd137b` feat: add pre-tool input transformers (#1279); `774c2254` Revert "Merge PR #758" — run `git show` on any of them.
  • Change coupling: onboarding_flow.rs ↔ ui_onboarding.rs crates/jcode-tui/src/tui/app/onboarding_flow.rs:1 — `crates/jcode-tui/src/tui/app/onboarding_flow.rs` and `crates/jcode-tui/src/tui/ui_onboarding.rs` change together 58% of the time (21 of the 36 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 21 shared commits counted here, the most recent 3 are `92f2f034` Telemetry settings: per-category checkboxes with Continue on top; `17e5598b` onboarding: fix Import less committing on Enter, cleaner first page, …; `25ed7fe7` tui: remove Jcode subscription option from onboarding import summary — run `git show` on any of them.
  • Change coupling: requests.rs ↔ parity.rs crates/jcode-harness-api/src/requests.rs:1 — `crates/jcode-harness-api/src/requests.rs` and `crates/jcode-sdk/src/sdk_tests/parity.rs` change together 58% of the time (14 of the 24 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 `2f703919` Expose native runtime commands through harness and SDK; `19110e6d` Move auto-poke and todo quality gates into a shared SDK policy; `14df6c06` harness api: expose background_tool (move running tool to background) — run `git show` on any of them.
  • Change coupling: comm_control.rs ↔ comm_plan.rs crates/jcode-app-core/src/server/comm_control.rs:1 — `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `af4f0d2a` swarm launch: one agent per todo lane, worker todo list is the lane, …; `f58e5201` Add swarm task graph helpers and centralize swarm state (at that commit the files were still `src/server/comm_control.rs` and `src/server/comm_plan.rs`); `03706e05` Harden swarm state and client subscribe flow (at that commit the files were still `src/server/comm_control.rs` and `src/server/comm_plan.rs`) — run `git show` on any of them.
  • Change coupling: todo.rs ↔ lifecycle.rs crates/jcode-app-core/src/tool/todo.rs:1 — `crates/jcode-app-core/src/tool/todo.rs` and `crates/jcode-telemetry-core/src/lifecycle.rs` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 11 shared commits counted here, the most recent 3 are `4973f3e1` feat(todo): gate feedback loop relevance and coverage; `abb0baab` feat(todo): gate feedback loop relevance and coverage; `0d48b768` telemetry: count todo progress without quoting any of it — run `git show` on any of them.
  • Change coupling: hotkey_feedback.rs ↔ ui_overlays.rs crates/jcode-tui/src/tui/app/hotkey_feedback.rs:1 — `crates/jcode-tui/src/tui/app/hotkey_feedback.rs` and `crates/jcode-tui/src/tui/ui_overlays.rs` change together 56% of the time (18 of the 32 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 18 shared commits counted here, the most recent 3 are `35b06b58` tui: Alt+G opens the project's git commit log; diff cycling moves to …; `6c33b79c` tui: Alt+Shift+M shows/hides the diagram pane, Alt+M stays side-panel…; `c556f2db` tui: Alt+M cycles side panel split -> fullscreen -> hidden — run `git show` on any of them.
  • Change coupling: client_comm_context.rs ↔ comm_format.rs crates/jcode-app-core/src/server/client_comm_context.rs:1 — `crates/jcode-app-core/src/server/client_comm_context.rs` and `crates/jcode-protocol/src/comm_format.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 `e2ad1db3` swarm: add stalled-worker watchdog (#1703); `b9cb0aaf` feat(swarm): add agents.swarm_effort pin and show worker effort in sw…; `d7d5d8ad` feat(swarm): add agents.swarm_effort pin and show worker effort in sw… — run `git show` on any of them.
  • Change coupling: keybindings.rs ↔ key_handling.rs crates/jcode-config-types/src/keybindings.rs:1 — `crates/jcode-config-types/src/keybindings.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.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 `fc34ea46` tui: Alt+Up/Down cycle speed tier (Standard, Fast, Ultrafast); `3309ad37` fix: configure auto-poke toggle key (fixes #945); `a5064b85` fix: configure auto-poke toggle key (fixes #945) — run `git show` on any of them.
  • Change coupling: onboarding_flow.rs ↔ mod.rs crates/jcode-tui/src/tui/app/onboarding_flow.rs:1 — `crates/jcode-tui/src/tui/app/onboarding_flow.rs` and `crates/jcode-tui/src/tui/mod.rs` change together 53% of the time (19 of the 36 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 19 shared commits counted here, the most recent 3 are `92f2f034` Telemetry settings: per-category checkboxes with Continue on top; `25ed7fe7` tui: remove Jcode subscription option from onboarding import summary; `145b8ba9` Offer Jcode subscription during onboarding — run `git show` on any of them.
  • Change coupling: activation.rs ↔ selection.rs crates/jcode-base/src/provider/activation.rs:1 — `crates/jcode-base/src/provider/activation.rs` and `crates/jcode-base/src/provider/selection.rs` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `659b8cc1` feat: add Grok Build ACP provider; `55ed0d77` feat: add Grok Build ACP provider; `d85dd178` fix: allow interactive cross-provider model switching (fixes #549) (#… — run `git show` on any of them.
  • Change coupling: anthropic.rs ↔ pricing.rs crates/jcode-base/src/provider/anthropic.rs:1 — `crates/jcode-base/src/provider/anthropic.rs` and `crates/jcode-provider-core/src/pricing.rs` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 9 shared commits counted here, the most recent 3 are `750fb60f` feat(anthropic): support Opus 5.5 mandatory adaptive thinking; `3b61d837` feat(anthropic): support Opus 5.5 mandatory adaptive thinking; `6e41fd59` feat(anthropic): add claude-fable-5-1 to the direct Anthropic catalog… — run `git show` on any of them.
  • + 3 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×28
  • Swallowed exception (caught, then discarded) scripts/audit_terminal_bench_submission.py:130 — `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) scripts/bench_memory_cli.py:288 — `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) scripts/bench_memory_cli.py:296 — `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) scripts/bench_memory_cli.py:329 — `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) scripts/bench_memory_cli.py:355 — `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) scripts/check_donut_animates_live.py:173 — `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) scripts/count_idle_draws.py:162 — `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) scripts/diagnose_idle_render_cost.py:210 — `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) scripts/diagnose_idle_render_cost.py:440 — `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) scripts/dump_fresh_spawn_screen.py:124 — `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) scripts/jcode_harbor_agent.py:139 — `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) scripts/jcode_memory_snapshot.py:74 — `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) scripts/jcode_memory_snapshot.py:81 — `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) scripts/jcode_monitor.py:69 — `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) scripts/jcode_monitor.py:79 — `except` 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/measure_animation_cpu_cost.py:59 — `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) scripts/pin_no_area_state.py:125 — `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) scripts/probe_idle_state.py:203 — `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) scripts/profile_idle_donut.py:155 — `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) scripts/reload_recovery_audit.py:468 — `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) scripts/repro_idle_session_rss.py:148 — `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) scripts/repro_input_flicker.py:285 — `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) scripts/repro_input_flicker.py:414 — `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) scripts/repro_input_flicker.py:682 — `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) scripts/repro_input_lag.py:259 — `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.
  • + 3 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×23
  • TodoComment crates/jcode-tui-render/src/swarm_gallery.rs:1724 — // ---- Todo card ---- — 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/jcode-tui-render/src/swarm_gallery_tests.rs:723 — // Todo names replace the less actionable transcript tail when present. — 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/jcode-tui-render/src/swarm_gallery_tests.rs:1121 — // Todo counter on the 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/jcode-tui/src/tui/app.rs:1092 — /// todo list at all) must leave auto-poke armed for the next batch of work; — 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/jcode-tui/src/tui/app.rs:1114 — /// Todo state at the final-response handoff. Unchanged finished work must — 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/jcode-tui/src/tui/ui_messages.rs:1262 — // Todo cards sit directly on the terminal background, so the global — 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/jcode-tui/src/tui/ui_messages.rs:1454 — /// Todo card for the pinned band at the top of the viewport. The band owns — 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/jcode-tui/src/tui/ui_messages.rs:4672 — // todo result while losing its paired ToolCall metadata. Recognize 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/jcode-tui/src/tui/ui_prepare.rs:1338 — // todo tool messages in display_messages for history/session fidelity, but — 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/jcode-tui/src/tui/app/subscribe_nudge.rs:211 — /// (todo tool completed locally or remotely). Arms a timer when incomplete — 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/jcode-tui/src/tui/app/tests/remote_events_reload_05.rs:1031 — // todo list at all, and again whenever a cycle completed. In practice that — 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/jcode-tui/src/tui/app/tests/state_model_poke_03.rs:2740 — // todo tool, the next completion check requests one clean final answer. — 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/jcode-todo-policy/src/lib.rs:337 — /// Todo group for goal-scoped observations; `None` for plan-level ones. — 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/jcode-todo-policy/src/lib.rs:885 — /// Todo groups are intended to name coherent goals, so the group containing 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/jcode-telemetry-core/src/lib.rs:97 — /// todo, goal, plan, or feedback-loop text those scores describe. — 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/jcode-task-types/src/lib.rs:539 — /// todo write, so a sloppy stage can never cost the model its plan. — 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/jcode-core/src/stdin_detect.rs:367 — // TODO: implement with windows-sys crate — 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/jcode-base/src/todo.rs:1 — //! Todo persistence plus a re-export of the shared pure policy in — 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/jcode-base/src/todo.rs:112 — /// todo list format (a bare `Vec<TodoItem>` array) stays readable by every — 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/jcode-app-core/src/tool/tests.rs:716 — // todo carries a deliberate "use it very often" directive requested by 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/jcode-app-core/src/tool/todo.rs:109 — // todo's reference must not prevent unrelated or assessment writes. — 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/jcode-app-core/src/server/swarm_persistence.rs:481 — /// Todo snapshots live only in memory on the swarm member, so a reload would — 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/jcode-app-core/src/server/swarm_todo_link.rs:676 — /// todo save, so lanes added or reshaped mid-run are picked up without a — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×23
  • Duplicated block (17 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2395 — crates/jcode-app-core/src/server/client_lifecycle.rs:2395-2411 | crates/jcode-app-core/src/server/client_lifecycle.rs:2425-2441 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_lifecycle_logging.rs:15 — crates/jcode-app-core/src/server/client_lifecycle_logging.rs:15-31 | crates/jcode-tui/src/tui/backend.rs:517-533 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/server/debug_swarm_read.rs:419 — crates/jcode-app-core/src/server/debug_swarm_read.rs:419-435 | crates/jcode-app-core/src/server/debug_swarm_read.rs:459-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 (17 lines × 2) crates/jcode-app-core/src/usage_openai.rs:175 — crates/jcode-app-core/src/usage_openai.rs:175-191 | crates/jcode-base/src/usage/openai_helpers.rs:189-205 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/jcode-base/src/auth/antigravity.rs:239 — crates/jcode-base/src/auth/antigravity.rs:239-255 | crates/jcode-base/REDACTED:365-381 — before extracting anything, compare `crates/jcode-base/src/auth/antigravity.rs` and `crates/jcode-base/REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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/jcode-base/src/import.rs:1041 — crates/jcode-base/src/import.rs:1041-1057 | crates/jcode-tui/src/tui/session_picker/loading.rs:2223-2239 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/jcode-base/src/usage/api_keys.rs:155 — crates/jcode-base/src/usage/api_keys.rs:155-171 | crates/jcode-base/src/usage/api_keys.rs:195-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/jcode-tui-account-picker/src/overlay.rs:376 — crates/jcode-tui-account-picker/src/overlay.rs:376-392 | crates/jcode-tui/src/tui/login_picker.rs:265-281 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 202 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/jcode-tui-style/src/color.rs:253 — crates/jcode-tui-style/src/color.rs:253-269 | crates/jcode-tui-workspace/src/color_support.rs:215-231 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:369 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:369-385 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:432-448 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/commands_improve.rs:306 — crates/jcode-tui/src/tui/app/commands_improve.rs:306-322 | crates/jcode-tui/src/tui/app/commands_improve.rs:353-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:3549 — crates/jcode-tui/src/tui/app/inline_interactive.rs:3549-3565 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3574-3590 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/local.rs:293 — crates/jcode-tui/src/tui/app/local.rs:293-309 | crates/jcode-tui/src/tui/app/remote.rs:770-786 — before extracting anything, compare `crates/jcode-tui/src/tui/app/local.rs` and `crates/jcode-tui/src/tui/app/remote.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 (17 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:2343 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:2343-2359 | crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:767-783 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-tui/src/tui/app/remote/key_handling.rs:2440 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:2440-2456 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:2596-2612 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/state_ui_storage.rs:267 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:267-283 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:373-400 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui_file_diff.rs:10 — crates/jcode-tui/src/tui/ui_file_diff.rs:10-26 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:10-26 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/ui_inline_image.rs:1113 — crates/jcode-tui/src/tui/ui_inline_image.rs:1113-1129 | crates/jcode-tui/src/tui/ui_prepare.rs:353-369 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:2051 — crates/jcode-tui/src/tui/ui_messages.rs:2051-2067 | crates/jcode-tui/src/tui/ui_messages.rs:2421-2437 — both copies are in the same file, so extract the block into 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) src/bin/memory_recall_bench.rs:496 — src/bin/memory_recall_bench.rs:496-512 | src/bin/memory_recall_bench.rs:2279-2295 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_comm_channels.rs:147 — crates/jcode-app-core/src/server/client_comm_channels.rs:147-163 | crates/jcode-app-core/src/server/client_comm_channels.rs:232-248 — both copies are in the same file, so extract the block into 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) scripts/benchmark_discovery.py:488 — scripts/benchmark_discovery.py:488-504 | scripts/benchmark_discovery_rate.py:448-464 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) ios/Sources/JCodeMobile/Views/SettingsView.swift:76 — ios/Sources/JCodeMobile/Views/SettingsView.swift:76-92 | ios/Sources/JCodeMobile/Views/SettingsView.swift:105-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ios/Sources/JCodeMobile/Views/SettingsView.swift:76` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ios/Sources/JCodeMobile/Views/SettingsView.swift:75` calls `lineLimit` and `ios/Sources/JCodeMobile/Views/SettingsView.swift:104` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D3 · God Classes · TooManyMethods · ×22
  • TooManyMethods: App crates/jcode-tui/src/tui/app.rs:965 — TooManyMethods — 969 methods, declared across 75 files: app/navigation.rs (65), app/onboarding_flow_control.rs (59), app/inline_interactive.rs (56), app/input.rs (53), +71 more file(s). The bar is 30 methods; this is 939 over it, 32.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Agent crates/jcode-app-core/src/agent.rs:319 — TooManyMethods — 269 methods, declared across 14 files: agent/turn_execution.rs (62), src/agent.rs (48), agent/provider.rs (48), agent/interrupts.rs (23), +10 more file(s). The bar is 30 methods; this is 239 over it, 8.97× 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: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:278 — TooManyMethods — 109 methods, declared across 5 files: tui/session_picker.rs (55), session_picker/filter.rs (20), session_picker/navigation.rs (19), session_picker/render.rs (10), +1 more file(s). The bar is 30 methods; this is 79 over it, 3.63× 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: Session crates/jcode-base/src/session.rs:120 — TooManyMethods — 96 methods, declared across 3 files: src/session.rs (78), session/persistence.rs (14), session/agent_models.rs (4). The bar is 30 methods; this is 66 over it, 3.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: MultiProvider crates/jcode-base/src/provider/mod.rs:384 — TooManyMethods — 95 methods, declared across 11 files: provider/mod.rs (18), provider/selection.rs (18), provider/startup.rs (18), provider/accessors.rs (13), +7 more file(s). The bar is 30 methods; this is 65 over it, 3.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RemoteConnection crates/jcode-tui/src/tui/backend.rs:235 — TooManyMethods — 82 methods. The bar is 30 methods; this is 52 over it, 2.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: OpenRouterProvider crates/jcode-provider-openrouter-runtime/src/lib.rs:825 — TooManyMethods — 78 methods, declared across 3 files: src/lib.rs (70), src/openrouter_provider_impl.rs (7), src/openai_compatible_runtime.rs (1). The bar is 30 methods; this is 48 over it, 2.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: JcodeClient crates/jcode-sdk/src/client.rs:353 — TooManyMethods — 74 methods, declared across 2 files: src/client.rs (73), src/structured.rs (1). The bar is 30 methods; this is 44 over it, 2.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: JcodeClient sdk/typescript/src/client.ts:223 — TooManyMethods — 73 methods. The bar is 30 methods; this is 43 over it, 2.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CompactionManager crates/jcode-base/src/compaction.rs:135 — TooManyMethods — 61 methods. The bar is 30 methods; this is 31 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.
  • TooManyMethods: MemoryManager crates/jcode-base/src/memory.rs:184 — TooManyMethods — 61 methods. The bar is 30 methods; this is 31 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.
  • TooManyMethods: BridgeState crates/jcode-harness-api-server/src/translate.rs:118 — TooManyMethods — 57 methods, declared across 2 files: src/translate.rs (51), translate/credentials.rs (6). The bar is 30 methods; this is 27 over it, 1.90× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Registry crates/jcode-app-core/src/tool/mod.rs:304 — TooManyMethods — 49 methods, declared across 2 files: tool/mod.rs (48), tool/name_suggestions.rs (1). The bar is 30 methods; this is 19 over it, 1.63× 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: OpenAIProvider crates/jcode-provider-openai-runtime/src/lib.rs:706 — TooManyMethods — 47 methods, declared across 3 files: src/lib.rs (45), src/model_selection.rs (1), src/native_compaction.rs (1). 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: Config crates/jcode-base/src/config.rs:597 — TooManyMethods — 44 methods, declared across 4 files: config/config_file.rs (40), config/default_file.rs (2), config/display_summary.rs (1), config/env_overrides.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: AnthropicProvider crates/jcode-provider-anthropic-runtime/src/lib.rs:470 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SelfDevTool crates/jcode-app-core/src/tool/selfdev/mod.rs:478 — TooManyMethods — 43 methods, declared across 6 files: selfdev/mod.rs (19), selfdev/build_queue.rs (12), selfdev/setup.rs (5), selfdev/launch.rs (3), +2 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BedrockProvider crates/jcode-provider-bedrock/src/lib.rs:96 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BackgroundTaskManager crates/jcode-base/src/background.rs:36 — 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.
  • TooManyMethods: SkillRegistry crates/jcode-base/src/skill.rs:45 — TooManyMethods — 33 methods, declared across 2 files: src/skill.rs (32), skill/invocation.rs (1). The bar is 30 methods; this is 3 over it, 1.10× 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: GmailClient crates/jcode-base/src/gmail.rs:144 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CopilotApiProvider crates/jcode-provider-copilot-runtime/src/lib.rs:44 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D3 · God Classes · TooManyFields · ×21
  • TooManyFields: App crates/jcode-tui/src/tui/app.rs:965 — TooManyFields — 400 stored fields beside 969 methods. The bar is 30 stored fields; this is 370 over it, 13.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: SessionLifecycleEvent crates/jcode-usage-types/src/lib.rs:545 — TooManyFields — 142 stored fields. The bar is 30 stored fields; this is 112 over it, 4.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: SessionTelemetry crates/jcode-telemetry-core/src/lib.rs:258 — TooManyFields — 110 stored fields. The bar is 30 stored fields; this is 80 over it, 3.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: TurnEndEvent crates/jcode-usage-types/src/lib.rs:744 — TooManyFields — 79 stored fields. 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: TurnTelemetry crates/jcode-telemetry-core/src/lib.rs:197 — TooManyFields — 57 stored fields beside 1 method. The bar is 30 stored fields; this is 27 over it, 1.90× 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: FramePerfStats crates/jcode-tui/src/tui/ui_frame_metrics.rs:11 — TooManyFields — 55 stored fields. The bar is 30 stored fields; this is 25 over it, 1.83× 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: MermaidDebugStats crates/jcode-tui-mermaid/src/lib.rs:1285 — TooManyFields — 49 stored fields. The bar is 30 stored fields; this is 19 over it, 1.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: ProductivityReport crates/jcode-productivity-core/src/model.rs:72 — TooManyFields — 44 stored fields. 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: Agent crates/jcode-app-core/src/agent.rs:319 — TooManyFields — 42 stored fields beside 269 methods. The bar is 30 stored fields; this is 12 over it, 1.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: Session crates/jcode-base/src/session.rs:120 — TooManyFields — 41 stored fields beside 96 methods. 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: TodoSessionEvent crates/jcode-usage-types/src/lib.rs:500 — 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: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:278 — TooManyFields — 39 stored fields beside 109 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: InfoWidgetData crates/jcode-tui/src/tui/info_widget.rs:668 — TooManyFields — 39 stored fields beside 5 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: CommunicateInput crates/jcode-app-core/src/tool/communicate.rs:1702 — TooManyFields — 38 stored fields beside 2 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: BridgeState crates/jcode-harness-api-server/src/translate.rs:118 — TooManyFields — 36 stored fields beside 57 methods. The bar is 30 stored fields; this is 6 over it, 1.20× 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: BrowserInput crates/jcode-app-core/src/tool/browser.rs:38 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× 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: KeybindingsConfig crates/jcode-config-types/src/lib.rs:1052 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× 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: DisplayConfig crates/jcode-config-types/src/display.rs:12 — TooManyFields — 35 stored fields beside 6 methods. The bar is 30 stored fields; this is 5 over it, 1.17× 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: ClientRuntimeMemoryTotals crates/jcode-base/src/runtime_memory_log.rs:99 — TooManyFields — 35 stored fields. The bar is 30 stored fields; this is 5 over it, 1.17× 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: ScrollTestState crates/jcode-tui/src/tui/app/debug.rs:459 — TooManyFields — 33 stored fields beside 2 methods. The bar is 30 stored fields; this is 3 over it, 1.10× 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: MermaidMemoryProfile crates/jcode-tui-mermaid/src/lib.rs:1387 — TooManyFields — 32 stored fields. The bar is 30 stored fields; this is 2 over it, 1.07× 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.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×18
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/agent/response_recovery.rs:31 — crates/jcode-app-core/src/agent/response_recovery.rs:31-48 | crates/jcode-provider-openai/src/stream.rs:109-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/message_notifications.rs:168 — crates/jcode-app-core/src/message_notifications.rs:168-185 | crates/jcode-base/src/message/notifications.rs:520-537 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 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 (18 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1044 — crates/jcode-app-core/src/server/client_lifecycle.rs:1044-1061 | crates/jcode-app-core/src/server/client_lifecycle.rs:3158-3175 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/client_session.rs:37 — crates/jcode-app-core/src/server/client_session.rs:37-54 | crates/jcode-app-core/src/server/client_state.rs:614-631 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/usage_openai.rs:264 — crates/jcode-app-core/src/usage_openai.rs:264-281 | crates/jcode-base/src/usage/openai_helpers.rs:278-295 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (18 lines × 2) crates/jcode-provider-copilot/src/lib.rs:167 — crates/jcode-provider-copilot/src/lib.rs:167-184 | crates/jcode-provider-openrouter/src/request.rs:227-244 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:769 — crates/jcode-provider-doctor/src/live_provider_probes.rs:769-786 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1097-1114 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/swarm_gallery.rs:838 — crates/jcode-tui-render/src/swarm_gallery.rs:838-855 | crates/jcode-tui-render/src/swarm_gallery.rs:1186-1203 — both copies are in the same file, so extract the block into 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/jcode-tui-style/src/color.rs:200 — crates/jcode-tui-style/src/color.rs:200-217 | crates/jcode-tui-workspace/src/color_support.rs:162-179 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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 (18 lines × 2) crates/jcode-tui-tool-display/src/lib.rs:155 — crates/jcode-tui-tool-display/src/lib.rs:155-172 | crates/jcode-tui/src/tui/ui_tools.rs:326-343 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) crates/jcode-tui/src/tui/app/commands_improve.rs:498 — crates/jcode-tui/src/tui/app/commands_improve.rs:498-515 | crates/jcode-tui/src/tui/app/commands_improve.rs:567-584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/jcode-tui/src/tui/app/debug.rs:437 — crates/jcode-tui/src/tui/app/debug.rs:437-454 | crates/jcode-tui/src/tui/memory_profile.rs:280-297 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:421 — crates/jcode-tui/src/tui/app/remote.rs:421-438 | crates/jcode-tui/src/tui/app/remote.rs:1713-1730 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/session_picker/loading.rs:2337 — crates/jcode-tui/src/tui/session_picker/loading.rs:2337-2354 | crates/jcode-tui/src/tui/session_picker/loading.rs:2421-2438 — both copies are in the same file, so extract the block into 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/jcode-voice/src/lib.rs:461 — crates/jcode-voice/src/lib.rs:461-478 | crates/jcode-voice/src/streaming_capture.rs:324-341 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) crates/jcode-provider-openai/src/request.rs:471 — crates/jcode-provider-openai/src/request.rs:471-488 | crates/jcode-provider-openai/src/request.rs:638-655 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/discover.rs:731 — crates/jcode-app-core/src/tool/discover.rs:731-748 | crates/jcode-app-core/src/tool/discover.rs:909-926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) scripts/repro_expand_edit_shortcut.py:235 — scripts/repro_expand_edit_shortcut.py:235-252 | scripts/repro_live_duplicate.py:205-222 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 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 lines × 2) · ×18
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/server/comm_plan.rs:177 — crates/jcode-app-core/src/server/comm_plan.rs:177-192 | crates/jcode-app-core/src/server/comm_plan.rs:543-558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/server/debug_session_admin.rs:179 — crates/jcode-app-core/src/server/debug_session_admin.rs:179-194 | crates/jcode-app-core/src/server/swarm.rs:1209-1224 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/jcode-app-core/src/server/reload_trace.rs:17 — crates/jcode-app-core/src/server/reload_trace.rs:17-32 | crates/jcode-message-types/src/lib.rs:593-608 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/tool/conversation_search.rs:208 — crates/jcode-app-core/src/tool/conversation_search.rs:208-223 | crates/jcode-base/src/memory_agent.rs:62-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/usage_display.rs:99 — crates/jcode-app-core/src/usage_display.rs:99-114 | crates/jcode-base/src/usage/display.rs:103-118 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/usage_openai.rs:219 — crates/jcode-app-core/src/usage_openai.rs:219-234 | crates/jcode-base/src/usage/openai_helpers.rs:233-248 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/jcode-base/src/provider/openrouter.rs:287 — crates/jcode-base/src/provider/openrouter.rs:287-302 | crates/jcode-provider-openrouter-runtime/src/lib.rs:372-387 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/jcode-tui-render/src/swarm_gallery.rs:409 — crates/jcode-tui-render/src/swarm_gallery.rs:409-424 | crates/jcode-tui-render/src/swarm_gallery.rs:481-496 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/remote/input_dispatch.rs:297 — crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:297-312 | crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:319-334 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/remote/key_handling.rs:2496 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:2496-2511 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:2652-2667 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/login_picker.rs:732 — crates/jcode-tui/src/tui/login_picker.rs:732-747 | crates/jcode-tui/src/tui/login_picker.rs:807-822 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/session_picker/loading.rs:367 — crates/jcode-tui/src/tui/session_picker/loading.rs:367-382 | crates/jcode-tui/src/tui/session_picker/loading.rs:591-606 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui.rs:2320 — crates/jcode-tui/src/tui/ui.rs:2320-2335 | crates/jcode-tui/src/tui/ui.rs:2347-2362 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/discover.rs:846 — crates/jcode-app-core/src/tool/discover.rs:846-861 | crates/jcode-app-core/src/tool/discover.rs:932-949 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/comm_control.rs:1400 — crates/jcode-app-core/src/server/comm_control.rs:1400-1415 | crates/jcode-app-core/src/server/comm_plan.rs:489-504 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.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. 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/jcode-tui/src/tui/ui_prepare.rs:1389 — crates/jcode-tui/src/tui/ui_prepare.rs:1389-1404 | crates/jcode-tui/src/tui/ui_prepare.rs:1541-1556 — both copies are in the same file, so extract the block into 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) scripts/repro_expand_edit_shortcut.py:264 — scripts/repro_expand_edit_shortcut.py:264-279 | scripts/repro_live_duplicate.py:227-242 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:689 — crates/jcode-provider-doctor/src/provider_e2e.rs:689-704 | crates/jcode-provider-doctor/src/provider_e2e.rs:1047-1062 — both copies are in the same file, so extract the 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 · MultiProvider · ×16
  • MultiProvider::complete_with_failover (cognitive 70) crates/jcode-base/src/provider/mod.rs:465 — MultiProvider::complete_with_failover has cognitive complexity 70 (threshold 15). Drivers by points: if/else 25 (56 pts), match/switch 6 (10 pts), boolean chains 3, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::new_with_auth_status (cognitive 57) crates/jcode-base/src/provider/startup.rs:71 — MultiProvider::new_with_auth_status has cognitive complexity 57 (threshold 15). Drivers by points: if/else 35 (44 pts), match/switch 3 (7 pts), boolean chains 6 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • MultiProvider::set_model_on_provider_with_credential_modes (cognitive 48) crates/jcode-base/src/provider/mod.rs:1052 — MultiProvider::set_model_on_provider_with_credential_modes has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 4 (10 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.
  • MultiProvider::cross_provider_pool_prompt (cognitive 45) crates/jcode-base/src/provider/multi_provider.rs:105 — MultiProvider::cross_provider_pool_prompt has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 9, match/switch 3 (5 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::handle_auth_changed (cognitive 44) crates/jcode-base/src/provider/mod.rs:1332 — MultiProvider::handle_auth_changed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 10, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::compute_fresh_session_pool_route (cognitive 34) crates/jcode-base/src/provider/startup.rs:477 — MultiProvider::compute_fresh_session_pool_route has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4 (7 pts), boolean chains 6, match/switch 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.
  • MultiProvider::set_model (cognitive 32) crates/jcode-base/src/provider/mod.rs:2053 — MultiProvider::set_model has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, match/switch 3 (5 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.
  • MultiProvider::fresh_routes_memo_entry (cognitive 26) crates/jcode-base/src/provider/catalog_memo.rs:185 — MultiProvider::fresh_routes_memo_entry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, 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.
  • MultiProvider::complete_on_provider (cognitive 25) crates/jcode-base/src/provider/dispatch.rs:57 — MultiProvider::complete_on_provider has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (MultiProvider::complete_split_on_provider) 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.
  • MultiProvider::complete_split_on_provider (cognitive 25) crates/jcode-base/src/provider/dispatch.rs:183 — MultiProvider::complete_split_on_provider has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (MultiProvider::complete_on_provider) 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.
  • MultiProvider::is_failover_route_pool_approved (cognitive 23) crates/jcode-base/src/provider/multi_provider.rs:7 — MultiProvider::is_failover_route_pool_approved has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • MultiProvider::native_compact (cognitive 19) crates/jcode-base/src/provider/mod.rs:2733 — MultiProvider::native_compact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MultiProvider::explicit_session_provider_key_for_model_request (cognitive 19) crates/jcode-base/src/provider/selection.rs:242 — MultiProvider::explicit_session_provider_key_for_model_request has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::model_switch_request_for_session_model (cognitive 18) crates/jcode-base/src/provider/selection.rs:371 — MultiProvider::model_switch_request_for_session_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • MultiProvider::fork_model_switch_request (cognitive 17) crates/jcode-base/src/provider/mod.rs:1635 — MultiProvider::fork_model_switch_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::auto_select_multi_account_for_provider (cognitive 16) crates/jcode-base/src/provider/startup.rs:684 — MultiProvider::auto_select_multi_account_for_provider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×15
  • Duplicated block (9 lines × 3) crates/jcode-app-core/src/channel.rs:228 — crates/jcode-app-core/src/channel.rs:228-237 | crates/jcode-app-core/src/channel.rs:437-446 | crates/jcode-app-core/src/channel.rs:699-707 — 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/jcode-app-core/src/notifications.rs:716 — crates/jcode-app-core/src/notifications.rs:716-724 | crates/jcode-app-core/src/notifications.rs:731-739 | crates/jcode-setup-hints/src/cli_launch_hints.rs:355-363 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) crates/jcode-app-core/src/server/debug_swarm_read.rs:417 — crates/jcode-app-core/src/server/debug_swarm_read.rs:417-425 | crates/jcode-app-core/src/server/debug_swarm_read.rs:457-465 | crates/jcode-app-core/src/server/debug_swarm_read.rs:483-491 — 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/jcode-app-core/src/server/jade_relay.rs:366 — crates/jcode-app-core/src/server/jade_relay.rs:366-374 | crates/jcode-app-core/src/server/jade_relay.rs:720-728 | crates/jcode-app-core/src/server/jade_relay.rs:764-772 — 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/jcode-app-core/src/telemetry_state.rs:270 — crates/jcode-app-core/src/telemetry_state.rs:270-278 | crates/jcode-telemetry-core/src/state_support.rs:313-321 | crates/jcode-tui/src/tui/app/support.rs:77-85 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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 (9 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:887 — crates/jcode-provider-doctor/src/live_provider_probes.rs:887-895 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1211-1219 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1403-1411 — 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/jcode-tui/src/tui/app/turn.rs:304 — crates/jcode-tui/src/tui/app/turn.rs:304-312 | crates/jcode-tui/src/tui/app/turn.rs:908-916 | crates/jcode-tui/src/tui/app/turn.rs:1210-1218 — 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) src/cli/commands.rs:607 — src/cli/commands.rs:607-615 | src/cli/commands.rs:860-868 | src/cli/commands.rs:1150-1158 — 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) src/cli/tui_launch.rs:625 — src/cli/tui_launch.rs:625-633 | src/cli/tui_launch.rs:655-663 | src/cli/tui_launch.rs:709-717 — 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/jcode-app-core/src/server/jade_relay.rs:109 — crates/jcode-app-core/src/server/jade_relay.rs:109-117 | crates/jcode-base/src/auth/mod.rs:184-192 | REDACTED:334-342 — 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/jcode-provider-doctor/src/live_provider_probes.rs:1287 — crates/jcode-provider-doctor/src/live_provider_probes.rs:1287-1295 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1345-1356 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1448-1465 — 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/jcode-base/src/auth/cursor.rs:557 — crates/jcode-base/src/auth/cursor.rs:557-565 | crates/jcode-base/src/auth/cursor.rs:603-611 | crates/jcode-base/src/provider/antigravity.rs:105-113 — 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 (9 lines × 3) crates/jcode-app-core/src/server/comm_control.rs:1522 — crates/jcode-app-core/src/server/comm_control.rs:1522-1530 | crates/jcode-app-core/src/server/comm_plan.rs:530-538 | crates/jcode-app-core/src/server/comm_plan.rs:676-684 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) scripts/benchmark_swarm.py:204 — scripts/benchmark_swarm.py:204-212 | scripts/benchmark_swarm.py:369-377 | scripts/benchmark_takehome.py:177-185 — 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 (9 lines × 3) scripts/repro_expand_edit_shortcut.py:436 — scripts/repro_expand_edit_shortcut.py:436-444 | scripts/repro_live_duplicate.py:447-455 | scripts/repro_startup_lag.py:83-91 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×15
  • Duplicated block (6 lines × 3) crates/jcode-app-core/src/ambient/runner.rs:464 — crates/jcode-app-core/src/ambient/runner.rs:464-469 | crates/jcode-app-core/src/server/client_actions.rs:890-895 | crates/jcode-tui/src/tui/app/commands.rs:386-391 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) crates/jcode-app-core/src/server/comm_session.rs:38 — crates/jcode-app-core/src/server/comm_session.rs:38-43 | crates/jcode-app-core/src/server/swarm_persistence.rs:36-41 | crates/jcode-app-core/src/server/swarm_persistence.rs:49-54 — 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/jcode-provider-doctor/src/live_provider_probes.rs:177 — crates/jcode-provider-doctor/src/live_provider_probes.rs:177-182 | crates/jcode-provider-doctor/src/live_provider_probes.rs:246-251 | crates/jcode-provider-doctor/src/live_provider_probes.rs:361-366 — 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/jcode-tui/src/tui/app/observe.rs:181 — crates/jcode-tui/src/tui/app/observe.rs:181-186 | crates/jcode-tui/src/tui/app/split_view.rs:52-57 | crates/jcode-tui/src/tui/app/todos_view.rs:268-273 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 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. 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/jcode-tui/src/tui/app/turn.rs:203 — crates/jcode-tui/src/tui/app/turn.rs:203-208 | crates/jcode-tui/src/tui/app/turn.rs:398-403 | crates/jcode-tui/src/tui/app/turn.rs:1504-1509 — 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/jcode-tui/src/tui/ui_inline_image.rs:1097 — crates/jcode-tui/src/tui/ui_inline_image.rs:1097-1102 | crates/jcode-tui/src/tui/ui_inline_image.rs:1117-1122 | crates/jcode-tui/src/tui/ui_prepare.rs:357-362 — 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/jcode-provider-copilot-runtime/src/lib.rs:111 — crates/jcode-provider-copilot-runtime/src/lib.rs:111-116 | crates/jcode-provider-cursor-runtime/src/lib.rs:440-445 | crates/jcode-provider-gemini-runtime/src/lib.rs:77-82 — 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/jcode-provider-copilot-runtime/src/lib.rs:1056 — crates/jcode-provider-copilot-runtime/src/lib.rs:1056-1061 | crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:880-886 | crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:347-352 — 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/jcode-tui-account-picker/src/overlay_render.rs:232 — crates/jcode-tui-account-picker/src/overlay_render.rs:232-237 | crates/jcode-tui-usage-overlay/src/lib.rs:656-661 | crates/jcode-tui/src/tui/login_picker.rs:613-618 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.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/jcode-tui/src/tui/app/observe.rs:321 — crates/jcode-tui/src/tui/app/observe.rs:321-326 | crates/jcode-tui/src/tui/app/split_view.rs:343-348 | crates/jcode-tui/src/tui/app/todos_view.rs:778-783 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 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. 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/jcode-tui/src/tui/app/remote/swarm_status_core.rs:36 — crates/jcode-tui/src/tui/app/remote/swarm_status_core.rs:36-41 | crates/jcode-tui/src/tui/info_widget_swarm_background.rs:125-130 | crates/jcode-tui/src/tui/info_widget_swarm_gallery.rs:20-25 — 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/jcode-tui/src/tui/app/hotkey_feedback.rs:643 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:643-648 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:136-141 | crates/jcode-tui/src/tui/app/swarm_hint.rs:35-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 all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) scripts/bench_headless_memory.py:150 — scripts/bench_headless_memory.py:150-155 | scripts/bench_headless_memory.py:241-246 | scripts/bench_headless_memory.py:473-478 — 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) scripts/check_donut_animates_live.py:104 — scripts/check_donut_animates_live.py:104-109 | scripts/dump_fresh_spawn_screen.py:67-72 | scripts/verify_donut_still_animates.py:108-113 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/dump_fresh_spawn_screen.py` as WHOLE FILES: this scan already matched 7 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. 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) scripts/check_donut_animates_live.py:110 — scripts/check_donut_animates_live.py:110-115 | scripts/dump_fresh_spawn_screen.py:73-78 | scripts/verify_donut_still_animates.py:114-119 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/dump_fresh_spawn_screen.py` as WHOLE FILES: this scan already matched 7 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · MultiProvider · ×14
  • MultiProvider::cross_provider_pool_prompt (cyclomatic 41) crates/jcode-base/src/provider/multi_provider.rs:105 — MultiProvider::cross_provider_pool_prompt 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.
  • MultiProvider::complete_with_failover (cyclomatic 34) crates/jcode-base/src/provider/mod.rs:465 — MultiProvider::complete_with_failover 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.
  • MultiProvider::handle_auth_changed (cyclomatic 34) crates/jcode-base/src/provider/mod.rs:1332 — MultiProvider::handle_auth_changed 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.
  • MultiProvider::new_with_auth_status (cyclomatic 32) crates/jcode-base/src/provider/startup.rs:71 — MultiProvider::new_with_auth_status has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • MultiProvider::set_model_on_provider_with_credential_modes (cyclomatic 30) crates/jcode-base/src/provider/mod.rs:1052 — MultiProvider::set_model_on_provider_with_credential_modes 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.
  • MultiProvider::set_model (cyclomatic 26) crates/jcode-base/src/provider/mod.rs:2053 — MultiProvider::set_model 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.
  • MultiProvider::compute_fresh_session_pool_route (cyclomatic 22) crates/jcode-base/src/provider/startup.rs:477 — MultiProvider::compute_fresh_session_pool_route 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.
  • MultiProvider::model_switch_request_for_session_route (cyclomatic 21) crates/jcode-base/src/provider/selection.rs:472 — MultiProvider::model_switch_request_for_session_route 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: MultiProvider::default_model_selection_from_route (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.
  • MultiProvider::is_failover_route_pool_approved (cyclomatic 20) crates/jcode-base/src/provider/multi_provider.rs:7 — MultiProvider::is_failover_route_pool_approved 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.
  • MultiProvider::fresh_routes_memo_entry (cyclomatic 17) crates/jcode-base/src/provider/catalog_memo.rs:185 — MultiProvider::fresh_routes_memo_entry 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.
  • MultiProvider::complete_on_provider (cyclomatic 16) crates/jcode-base/src/provider/dispatch.rs:57 — MultiProvider::complete_on_provider has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (MultiProvider::complete_split_on_provider) 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.
  • MultiProvider::complete_split_on_provider (cyclomatic 16) crates/jcode-base/src/provider/dispatch.rs:183 — MultiProvider::complete_split_on_provider has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (MultiProvider::complete_on_provider) 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.
  • MultiProvider::fork_model_switch_request (cyclomatic 16) crates/jcode-base/src/provider/mod.rs:1635 — MultiProvider::fork_model_switch_request has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MultiProvider::model_switch_request_for_session_model (cyclomatic 16) crates/jcode-base/src/provider/selection.rs:371 — MultiProvider::model_switch_request_for_session_model 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: MultiProvider::default_model_selection_from_route (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.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×14
  • Duplicated block (8 lines × 3) crates/jcode-app-core/src/tool/agentgrep/context.rs:839 — crates/jcode-app-core/src/tool/agentgrep/context.rs:839-846 | crates/jcode-app-core/src/tool/agentgrep/context.rs:856-863 | crates/jcode-app-core/src/tool/agentgrep/context.rs:874-881 — 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/jcode-base/src/auth/mod.rs:293 — crates/jcode-base/src/auth/mod.rs:293-300 | crates/jcode-base/src/auth/mod.rs:322-329 | crates/jcode-base/src/auth/mod.rs:398-405 — 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/jcode-core/src/panic_util.rs:2 — crates/jcode-core/src/panic_util.rs:2-9 | crates/jcode-tui-mermaid/src/lib.rs:195-202 | src/cli/terminal.rs:225-232 — 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 (8 lines × 3) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:28 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:28-36 | crates/jcode-provider-copilot-runtime/src/routing.rs:38-45 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2330-2339 — 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 (8 lines × 3) crates/jcode-setup-hints/src/lib.rs:875 — crates/jcode-setup-hints/src/lib.rs:875-882 | crates/jcode-setup-hints/src/lib.rs:1145-1152 | crates/jcode-setup-hints/src/lib.rs:1418-1425 — 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/jcode-tui/src/tui/app/hotkey_feedback.rs:651 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:651-658 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:144-151 | crates/jcode-tui/src/tui/app/swarm_hint.rs:43-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 (8 lines × 3) crates/jcode-app-core/src/server/background_tasks.rs:620 — crates/jcode-app-core/src/server/background_tasks.rs:620-627 | crates/jcode-tui/src/tui/app/turn_notify.rs:373-380 | crates/jcode-tui/src/tui/ui_input.rs:2298-2305 — 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 (8 lines × 3) crates/jcode-tui/src/tui/app/observe.rs:192 — crates/jcode-tui/src/tui/app/observe.rs:192-199 | crates/jcode-tui/src/tui/app/split_view.rs:63-70 | crates/jcode-tui/src/tui/app/todos_view.rs:279-286 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 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. 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/jcode-tui/src/tui/app/state_ui_storage.rs:213 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:213-220 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:279-302 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:349-376 — 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/jcode-app-core/src/tool/discover.rs:1043 — crates/jcode-app-core/src/tool/discover.rs:1043-1050 | crates/jcode-app-core/src/tool/discover.rs:1234-1244 | crates/jcode-app-core/src/tool/discover.rs:1316-1326 — 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/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:227 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:227-234 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:398-405 | crates/jcode-tui/src/tui/login_picker.rs:786-796 — 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/jcode-app-core/src/tool/discover.rs:1035 — crates/jcode-app-core/src/tool/discover.rs:1035-1042 | crates/jcode-app-core/src/tool/discover.rs:1226-1233 | crates/jcode-app-core/src/tool/discover.rs:1308-1315 — 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/jcode-app-core/src/server/debug_swarm_write.rs:256 — crates/jcode-app-core/src/server/debug_swarm_write.rs:256-263 | crates/jcode-app-core/src/server/debug_swarm_write.rs:345-352 | crates/jcode-app-core/src/server/debug_swarm_write.rs:448-455 — 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/jcode-app-core/src/server/comm_control.rs:1466 — crates/jcode-app-core/src/server/comm_control.rs:1466-1473 | crates/jcode-app-core/src/server/comm_control.rs:1521-1528 | crates/jcode-app-core/src/server/comm_plan.rs:529-536 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.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. 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 (10 lines × 3) · ×13
  • Duplicated block (10 lines × 3) crates/jcode-app-core/src/tool/agentgrep/context.rs:969 — crates/jcode-app-core/src/tool/agentgrep/context.rs:969-978 | crates/jcode-app-core/src/tool/agentgrep/context.rs:991-1000 | crates/jcode-app-core/src/tool/agentgrep/context.rs:1013-1022 — 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/jcode-app-core/src/usage_display.rs:117 — crates/jcode-app-core/src/usage_display.rs:117-126 | crates/jcode-base/src/usage/display.rs:121-130 | crates/jcode-tui-usage-overlay/src/lib.rs:732-741 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 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 × 3) crates/jcode-base/src/auth/antigravity.rs:542 — crates/jcode-base/src/auth/antigravity.rs:542-551 | crates/jcode-base/REDACTED:585-594 | crates/jcode-base/REDACTED:599-608 — before extracting anything, compare `crates/jcode-base/src/auth/antigravity.rs` and `crates/jcode-base/REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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/jcode-base/src/prompt.rs:927 — crates/jcode-base/src/prompt.rs:927-936 | crates/jcode-base/src/prompt.rs:982-991 | crates/jcode-base/src/prompt.rs:1027-1036 — 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/jcode-base/src/provider/dispatch.rs:94 — crates/jcode-base/src/provider/dispatch.rs:94-103 | crates/jcode-base/src/provider/dispatch.rs:124-133 | crates/jcode-base/src/provider/dispatch.rs:141-150 — 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/jcode-tui-account-picker/src/overlay.rs:476 — crates/jcode-tui-account-picker/src/overlay.rs:476-485 | crates/jcode-tui-usage-overlay/src/lib.rs:458-467 | crates/jcode-tui/src/tui/login_picker.rs:364-373 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 3) crates/jcode-tui-permissions/src/lib.rs:120 — crates/jcode-tui-permissions/src/lib.rs:120-129 | crates/jcode-tui-permissions/src/lib.rs:445-454 | crates/jcode-tui-permissions/src/lib.rs:474-483 — 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/jcode-tui/src/tui/app/runtime_memory.rs:81 — crates/jcode-tui/src/tui/app/runtime_memory.rs:81-90 | crates/jcode-tui/src/tui/app/runtime_memory.rs:131-140 | crates/jcode-tui/src/tui/app/runtime_memory.rs:168-177 — 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/jcode-tui/src/tui/ui_messages.rs:3950 — crates/jcode-tui/src/tui/ui_messages.rs:3950-3959 | crates/jcode-tui/src/tui/ui_messages.rs:4128-4137 | crates/jcode-tui/src/tui/ui_messages.rs:4155-4164 — 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/jcode-app-core/src/agent/inline_tail.rs:170 — crates/jcode-app-core/src/agent/inline_tail.rs:170-179 | crates/jcode-app-core/src/agent/streaming.rs:35-44 | crates/jcode-session-types/src/lib.rs:964-973 — 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/jcode-base/src/hooks.rs:370 — crates/jcode-base/src/hooks.rs:370-379 | crates/jcode-core/src/util.rs:5-15 | crates/jcode-import-core/src/lib.rs:20-29 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) scripts/jcode_harbor_agent.py:289 — scripts/jcode_harbor_agent.py:289-298 | scripts/jcode_harbor_agent.py:306-315 | scripts/jcode_harbor_claude_agent.py:318-327 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 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) src/cli/auth_test/types.rs:72 — src/cli/auth_test/types.rs:72-81 | src/cli/auth_test/types.rs:87-96 | src/cli/auth_test/types.rs:133-142 — 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.
D2 · Cognitive Complexity · jcode_tui_markdown · ×12
  • jcode_tui_markdown::markdown_render_full::render_markdown_with_width (cognitive 250) crates/jcode-tui-markdown/src/markdown_render_full.rs:20 — jcode_tui_markdown::markdown_render_full::render_markdown_with_width has cognitive complexity 250 (threshold 15). Drivers by points: if/else 78 (183 pts), match/switch 10 (31 pts), loops 7 (19 pts), boolean chains 17 (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.
  • jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy (cognitive 243) crates/jcode-tui-markdown/src/markdown_render_lazy.rs:3 — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy has cognitive complexity 243 (threshold 15). Drivers by points: if/else 75 (179 pts), match/switch 10 (31 pts), loops 5 (18 pts), boolean chains 15 (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.
  • jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines (cognitive 57) crates/jcode-tui-markdown/src/markdown_render_support.rs:10 — jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 5 (18 pts), boolean chains 5 (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.
  • jcode_tui_markdown::markdown_wrap::wrap_line (cognitive 55) crates/jcode-tui-markdown/src/markdown_wrap.rs:5 — jcode_tui_markdown::markdown_wrap::wrap_line has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (43 pts), loops 3 (7 pts), boolean chains 5 (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.
  • jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars (cognitive 53) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3 — jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 6 (13 pts), boolean chains 9 (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.
  • jcode_tui_markdown::markdown_render_support::render_table_aligned (cognitive 52) crates/jcode-tui-markdown/src/markdown_render_support.rs:168 — jcode_tui_markdown::markdown_render_support::render_table_aligned has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 7 (17 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_tui_markdown::markdown_text_preprocess::preserve_line_oriented_softbreaks (cognitive 23) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:144 — jcode_tui_markdown::markdown_text_preprocess::preserve_line_oriented_softbreaks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_markdown::markdown_render_support::wrap_table_cell (cognitive 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:307 — jcode_tui_markdown::markdown_render_support::wrap_table_cell has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_markdown::markdown_wrap::balanced_wrap_breaks (cognitive 21) crates/jcode-tui-markdown/src/markdown_wrap.rs:446 — jcode_tui_markdown::markdown_wrap::balanced_wrap_breaks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 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.
  • jcode_tui_markdown::recenter_structured_blocks_for_display (cognitive 18) crates/jcode-tui-markdown/src/lib.rs:919 — jcode_tui_markdown::recenter_structured_blocks_for_display has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 4 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • jcode_tui_markdown::normalize_block_separators (cognitive 17) crates/jcode-tui-markdown/src/lib.rs:398 — jcode_tui_markdown::normalize_block_separators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 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.
  • jcode_tui_markdown::markdown_wrap::tokenize_balanced_wrap (cognitive 17) crates/jcode-tui-markdown/src/markdown_wrap.rs:381 — jcode_tui_markdown::markdown_wrap::tokenize_balanced_wrap has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFunctions · ×12
  • TooManyFunctions: jcode_base::auth::codex crates/jcode-base/src/auth/codex.rs:62 — 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: jcode_telemetry_core::state_support crates/jcode-telemetry-core/src/state_support.rs:7 — TooManyFunctions — 40 free functions. The bar is 30 free functions; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_build_support::paths crates/jcode-build-support/src/paths.rs:14 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_logging crates/jcode-logging/src/lib.rs:67 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_app_core::telemetry_state crates/jcode-app-core/src/telemetry_state.rs:7 — TooManyFunctions — 38 free functions. The bar is 30 free functions; 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.
  • TooManyFunctions: jcode_tui_mermaid::mermaid_runtime crates/jcode-tui-mermaid/src/mermaid_runtime.rs:39 — TooManyFunctions — 38 free functions. The bar is 30 free functions; 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.
  • TooManyFunctions: jcode_base::auth::external crates/jcode-base/src/auth/external.rs:66 — TooManyFunctions — 36 free functions. The bar is 30 free functions; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_base::auth::gemini crates/jcode-base/REDACTED:39 — TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_base::auth::cursor crates/jcode-base/src/auth/cursor.rs:93 — 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: jcode_tui_style::theme crates/jcode-tui-style/src/theme.rs:5 — 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: jcode_base::memory::pending crates/jcode-base/src/memory/pending.rs:72 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_tui::tui::keybind crates/jcode-tui/src/tui/keybind.rs:26 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/jcode-app-core/src/perf.rs:364 — crates/jcode-app-core/src/perf.rs:364-380 | crates/jcode-setup-hints/src/lib.rs:2390-2408 | crates/jcode-tui-style/src/color.rs:59-81 | crates/jcode-tui-workspace/src/color_support.rs:30-50 — 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/jcode-app-core/src/server/comm_session.rs:34 — crates/jcode-app-core/src/server/comm_session.rs:34-47 | crates/jcode-app-core/src/server/swarm_persistence.rs:34-45 | crates/jcode-app-core/src/server/swarm_persistence.rs:47-58 | crates/jcode-base/src/usage/flight.rs:13-25 — 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/jcode-app-core/src/tool/conversation_search.rs:83 — crates/jcode-app-core/src/tool/conversation_search.rs:83-234 | crates/jcode-base/src/memory_agent.rs:34-79 | crates/jcode-base/src/memory_prompt.rs:14-51 | crates/jcode-base/src/memory_prompt.rs:53-91 — 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/jcode-app-core/src/tool/session_search.rs:866 — crates/jcode-app-core/src/tool/session_search.rs:866-907 | crates/jcode-app-core/src/tool/session_search.rs:938-974 | crates/jcode-app-core/src/tool/session_search.rs:1145-1183 | crates/jcode-app-core/src/tool/session_search.rs:1251-1320 — 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/jcode-core/src/panic_util.rs:1 — crates/jcode-core/src/panic_util.rs:1-9 | crates/jcode-pdf/src/lib.rs:22-30 | crates/jcode-tui-mermaid/src/lib.rs:194-202 | src/cli/terminal.rs:224-232 — 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) scripts/check_code_size_budget.py:41 — scripts/check_code_size_budget.py:41-58 | scripts/check_panic_budget.py:40-55 | scripts/check_swallowed_error_budget.py:47-62 | scripts/check_test_size_budget.py:32-47 — 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) scripts/check_code_size_budget.py:111 — scripts/check_code_size_budget.py:111-171 | scripts/check_panic_budget.py:147-196 | scripts/check_swallowed_error_budget.py:183-248 | scripts/check_test_size_budget.py:99-145 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:114 — scripts/diagnose_idle_render_cost.py:114-124 | scripts/repro_input_flicker.py:125-135 | scripts/repro_input_lag.py:127-137 | scripts/repro_slash_flicker.py:121-131 — 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) scripts/diagnose_idle_render_cost.py:200 — scripts/diagnose_idle_render_cost.py:200-215 | scripts/repro_input_flicker.py:275-290 | scripts/repro_input_lag.py:249-264 | scripts/repro_slash_flicker.py:218-233 — 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) scripts/diagnose_idle_render_cost.py:220 — scripts/diagnose_idle_render_cost.py:220-237 | scripts/repro_input_flicker.py:295-317 | scripts/repro_input_lag.py:270-290 | scripts/repro_slash_flicker.py:238-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/jcode-provider-doctor/src/provider_e2e.rs:402 — crates/jcode-provider-doctor/src/provider_e2e.rs:402-554 | crates/jcode-provider-doctor/src/provider_e2e.rs:618-848 | crates/jcode-provider-doctor/src/provider_e2e.rs:1018-1208 | crates/jcode-provider-doctor/src/provider_e2e.rs:1649-1858 — 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) ios/TestHarness/reward/scorers/consistency.py:94 — ios/TestHarness/reward/scorers/consistency.py:94-139 | ios/TestHarness/reward/scorers/rhythm.py:71-121 | ios/TestHarness/reward/scorers/simplicity.py:250-316 | ios/TestHarness/reward/scorers/styling.py:183-274 — 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.
X3 · Exception handling · Swallowed exception (empty catch) · ×12
  • Swallowed exception (empty catch) telemetry-worker/src/worker.js:735 — 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-worker/src/worker.js:848 — 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) scripts/bench_headless_memory.py:257 — 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) scripts/bench_headless_memory.py:355 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
  • Swallowed exception (empty catch) scripts/bench_memory_cli.py:491 — 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) scripts/bench_startup_visible_ready.py:257 — 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) scripts/benchmark_takehome.py:189 — 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) scripts/benchmark_takehome.py:307 — 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) scripts/benchmark_takehome.py:315 — 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) scripts/check_donut_animates_live.py:125 — 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) scripts/jcode_monitor.py:104 — 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) scripts/repro_idle_session_rss.py:156 — 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.
D2 · Cognitive Complexity · jcode_tui_mermaid · ×11
  • jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner (cognitive 57) crates/jcode-tui-mermaid/src/mermaid_widget.rs:334 — jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner has cognitive complexity 57 (threshold 15). Drivers by points: if/else 38 (50 pts), boolean chains 7 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • jcode_tui_mermaid::mermaid_inline::dimensions_from_header (cognitive 48) crates/jcode-tui-mermaid/src/mermaid_inline.rs:269 — jcode_tui_mermaid::mermaid_inline::dimensions_from_header has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 14, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise (cognitive 48) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1355 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 9, match/switch 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.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner (cognitive 46) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1030 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal (cognitive 44) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1173 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal has cognitive complexity 44 (threshold 15). Drivers by points: if/else 29 (42 pts), boolean chains 1, 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget (cognitive 41) crates/jcode-tui-mermaid/src/mermaid_widget.rs:81 — jcode_tui_mermaid::mermaid_widget::render_image_widget has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 7 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame (cognitive 39) crates/jcode-tui-mermaid/src/mermaid_kitty_classic.rs:226 — jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 7 (11 pts), boolean chains 4, match/switch 1 (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.
  • jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport (cognitive 32) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:454 — jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (6 pts), boolean chains 2, 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.
  • jcode_tui_mermaid::debug::debug_test_scroll (cognitive 29) crates/jcode-tui-mermaid/src/debug.rs:307 — jcode_tui_mermaid::debug::debug_test_scroll has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 2 (5 pts), boolean chains 3, 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.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable (cognitive 18) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1205 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 4, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui_mermaid::mermaid_viewport::render_non_kitty_fit_stable (cognitive 17) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1062 — jcode_tui_mermaid::mermaid_viewport::render_non_kitty_fit_stable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D1 · Cyclomatic Complexity · jcode_tui_mermaid · ×10
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise (cyclomatic 36) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1355 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner (cyclomatic 35) crates/jcode-tui-mermaid/src/mermaid_widget.rs:334 — jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal (cyclomatic 31) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1173 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal 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.
  • jcode_tui_mermaid::mermaid_inline::dimensions_from_header (cyclomatic 31) crates/jcode-tui-mermaid/src/mermaid_inline.rs:269 — jcode_tui_mermaid::mermaid_inline::dimensions_from_header 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget (cyclomatic 28) crates/jcode-tui-mermaid/src/mermaid_widget.rs:81 — jcode_tui_mermaid::mermaid_widget::render_image_widget 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.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner (cyclomatic 24) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1030 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner 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.
  • jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame (cyclomatic 24) crates/jcode-tui-mermaid/src/mermaid_kitty_classic.rs:226 — jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame 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.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable (cyclomatic 18) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1205 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable 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.
  • jcode_tui_mermaid::debug::debug_test_scroll (cyclomatic 17) crates/jcode-tui-mermaid/src/debug.rs:307 — jcode_tui_mermaid::debug::debug_test_scroll 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.
  • jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport (cyclomatic 17) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:454 — jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport 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 · Agent · ×10
  • Agent::run_turn_streaming_mpsc (cognitive 460) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:225 — Agent::run_turn_streaming_mpsc has cognitive complexity 460 (threshold 15). Drivers by points: if/else 115 (350 pts), match/switch 14 (47 pts), loops 15 (46 pts), boolean chains 17 (nesting depth added 299). 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.
  • Agent::run_turn (cognitive 418) crates/jcode-app-core/src/agent/turn_loops.rs:56 — Agent::run_turn has cognitive complexity 418 (threshold 15). Drivers by points: if/else 113 (364 pts), match/switch 7 (23 pts), loops 7 (18 pts), boolean chains 13 (nesting depth added 278). 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.
  • Agent::repair_missing_tool_outputs (cognitive 32) crates/jcode-app-core/src/agent.rs:1103 — Agent::repair_missing_tool_outputs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 6 (10 pts), match/switch 2 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Agent::extract_session_memories (cognitive 31) crates/jcode-app-core/src/agent/turn_execution.rs:1465 — Agent::extract_session_memories has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (9 pts), loops 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.
  • Agent::repl (cognitive 26) crates/jcode-app-core/src/agent/turn_execution.rs:1377 — Agent::repl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Agent::export_conversation_markdown (cognitive 22) crates/jcode-app-core/src/agent/messages.rs:166 — Agent::export_conversation_markdown has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Agent::validate_tool_allowed (cognitive 18) crates/jcode-app-core/src/agent/turn_execution.rs:1079 — Agent::validate_tool_allowed 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.
  • Agent::messages_for_provider (cognitive 18) crates/jcode-app-core/src/agent.rs:981 — Agent::messages_for_provider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (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.
  • Agent::parse_text_wrapped_tool_call (cognitive 17) crates/jcode-app-core/src/agent/response_recovery.rs:28 — Agent::parse_text_wrapped_tool_call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 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.
  • Agent::seed_announced_skills_from_transcript (cognitive 16) crates/jcode-app-core/src/agent/turn_execution.rs:851 — Agent::seed_announced_skills_from_transcript has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (7 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 · jcode_tui_render · ×10
  • jcode_tui_render::swarm_gallery::render_swarm_strip_vertical (cognitive 121) crates/jcode-tui-render/src/swarm_gallery.rs:957 — jcode_tui_render::swarm_gallery::render_swarm_strip_vertical has cognitive complexity 121 (threshold 15). Drivers by points: if/else 53 (97 pts), loops 6 (13 pts), boolean chains 11 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_render::swarm_gallery::render_swarm_strip (cognitive 93) crates/jcode-tui-render/src/swarm_gallery.rs:624 — jcode_tui_render::swarm_gallery::render_swarm_strip has cognitive complexity 93 (threshold 15). Drivers by points: if/else 41 (72 pts), loops 6 (11 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_render::memory_tiles::render_memory_tiles (cognitive 59) crates/jcode-tui-render/src/memory_tiles.rs:413 — jcode_tui_render::memory_tiles::render_memory_tiles has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 8 (19 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_render::swarm_gallery::hovered_detail_body (cognitive 49) crates/jcode-tui-render/src/swarm_gallery.rs:1705 — jcode_tui_render::swarm_gallery::hovered_detail_body has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 3 (8 pts), match/switch 2 (8 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.
  • jcode_tui_render::memory_tiles::memory_tile_content_lines (cognitive 38) crates/jcode-tui-render/src/memory_tiles.rs:217 — jcode_tui_render::memory_tiles::memory_tile_content_lines has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 3 (7 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_render::memory_tiles::parse_memory_display_entries (cognitive 23) crates/jcode-tui-render/src/memory_tiles.rs:38 — jcode_tui_render::memory_tiles::parse_memory_display_entries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 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.
  • jcode_tui_render::swarm_tiles::render_swarm_gallery (cognitive 21) crates/jcode-tui-render/src/swarm_tiles.rs:353 — jcode_tui_render::swarm_tiles::render_swarm_gallery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (6 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.
  • jcode_tui_render::truncate_line_to_width (cognitive 19) crates/jcode-tui-render/src/lib.rs:71 — jcode_tui_render::truncate_line_to_width has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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.
  • jcode_tui_render::truncate_line_with_ellipsis_to_width (cognitive 19) crates/jcode-tui-render/src/lib.rs:112 — jcode_tui_render::truncate_line_with_ellipsis_to_width has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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.
  • jcode_tui_render::swarm_gallery::render_swarm_dock (cognitive 16) crates/jcode-tui-render/src/swarm_gallery.rs:1282 — jcode_tui_render::swarm_gallery::render_swarm_dock has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 2, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×10
  • Duplicated block (9–10 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1930 — crates/jcode-app-core/src/server/client_session.rs:1930-1938 | crates/jcode-app-core/src/server/debug_session_admin.rs:208-217 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) crates/jcode-base/src/auth/google.rs:388 — crates/jcode-base/src/auth/google.rs:388-397 | crates/jcode-base/src/auth/oauth.rs:900-908 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2325 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2325-2334 | scripts/repro/tls-bad-record-mac/src/main.rs:79-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–10 lines × 2) crates/jcode-tui/src/tui/app/auth.rs:1019 — crates/jcode-tui/src/tui/app/auth.rs:1019-1028 | crates/jcode-tui/src/tui/app/auth_account_commands.rs:502-510 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) crates/jcode-tui/src/tui/app/input.rs:3785 — crates/jcode-tui/src/tui/app/input.rs:3785-3794 | crates/jcode-tui/src/tui/app/input.rs:3851-3859 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/info_widget_swarm_background.rs:345 — crates/jcode-tui/src/tui/info_widget_swarm_background.rs:345-353 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:17-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) crates/jcode-tui/src/tui/ui_frame_metrics.rs:1210 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:1210-1219 | crates/jcode-tui/src/tui/ui_header.rs:456-464 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) scripts/bench_startup.py:170 — scripts/bench_startup.py:170-179 | scripts/profile_spawn.py: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–10 lines × 2) scripts/profile_real_spawn.py:33 — scripts/profile_real_spawn.py:33-41 | scripts/repro_real_spawn_lag.py:149-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_real_spawn_lag.py:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:17 — crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:17-26 | crates/jcode-tui/src/tui/ui_tests/onboarding.rs:17-25 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
D2 · Cognitive Complexity · SessionPicker · ×9
  • SessionPicker::build_preview_cache (cognitive 66) crates/jcode-tui/src/tui/session_picker.rs:1674 — SessionPicker::build_preview_cache has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (37 pts), loops 7 (17 pts), boolean chains 7, match/switch 3 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionPicker::run_with_session_updates (cognitive 46) crates/jcode-tui/src/tui/session_picker.rs:2542 — SessionPicker::run_with_session_updates has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 5 (18 pts), boolean chains 2, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionPicker::render_session_item_lines_at_frame (cognitive 43) crates/jcode-tui/src/tui/session_picker/render.rs:176 — SessionPicker::render_session_item_lines_at_frame has cognitive complexity 43 (threshold 15). Drivers by points: if/else 33 (35 pts), match/switch 3 (6 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.
  • SessionPicker::rebuild_items (cognitive 39) crates/jcode-tui/src/tui/session_picker/filter.rs:184 — SessionPicker::rebuild_items has cognitive complexity 39 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 8 (14 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 18). 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.
  • SessionPicker::render_session_list (cognitive 28) crates/jcode-tui/src/tui/session_picker/render.rs:428 — SessionPicker::render_session_list has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (21 pts), match/switch 2 (4 pts), boolean chains 3 (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.
  • SessionPicker::highlight_spans (cognitive 25) crates/jcode-tui/src/tui/session_picker/render.rs:94 — SessionPicker::highlight_spans has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5 (10 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.
  • SessionPicker::handle_overlay_key (cognitive 25) crates/jcode-tui/src/tui/session_picker.rs:1252 — SessionPicker::handle_overlay_key has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionPicker::render_preview (cognitive 25) crates/jcode-tui/src/tui/session_picker.rs:1373 — SessionPicker::render_preview has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • SessionPicker::format_estimated_tokens (cognitive 17) crates/jcode-tui/src/tui/session_picker/render.rs:38 — SessionPicker::format_estimated_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 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 · jcode_provider_core · ×9
  • jcode_provider_core::models::open_weight_family_context_limit (cognitive 34) crates/jcode-provider-core/src/models.rs:361 — jcode_provider_core::models::open_weight_family_context_limit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 7 (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.
  • jcode_provider_core::model_names::pretty_picker_model_name (cognitive 24) crates/jcode-provider-core/src/model_names.rs:401 — jcode_provider_core::model_names::pretty_picker_model_name has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, match/switch 3 (4 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.
  • jcode_provider_core::openai_schema::schema_supports_strict::check_map (cognitive 20) crates/jcode-provider-core/src/openai_schema.rs:43 — jcode_provider_core::openai_schema::schema_supports_strict::check_map has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, match/switch 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::reasoning::inferred_reasoning_efforts (cognitive 20) crates/jcode-provider-core/src/reasoning.rs:39 — jcode_provider_core::reasoning::inferred_reasoning_efforts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::model_names::pretty_picker_token (cognitive 19) crates/jcode-provider-core/src/model_names.rs:511 — jcode_provider_core::model_names::pretty_picker_token has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::ws_deflate::parse_extension_response (cognitive 18) crates/jcode-provider-core/src/ws_deflate.rs:62 — jcode_provider_core::ws_deflate::parse_extension_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::anthropic::anthropic_reasoning_caps (cognitive 17) crates/jcode-provider-core/src/anthropic.rs:336 — jcode_provider_core::anthropic::anthropic_reasoning_caps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • jcode_provider_core::models::context_limit_for_model_with_provider_and_cache (cognitive 17) crates/jcode-provider-core/src/models.rs:241 — jcode_provider_core::models::context_limit_for_model_with_provider_and_cache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_provider_core::openai_schema::make_schema_nullable (cognitive 16) crates/jcode-provider-core/src/openai_schema.rs:193 — jcode_provider_core::openai_schema::make_schema_nullable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×9
  • Duplicated block (19 lines × 2) crates/jcode-app-core/src/server/background_tasks.rs:55 — crates/jcode-app-core/src/server/background_tasks.rs:55-73 | crates/jcode-app-core/src/server/background_tasks.rs:142-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1521 — crates/jcode-app-core/src/server/client_session.rs:1521-1539 | crates/jcode-app-core/src/server/client_session.rs:1694-1712 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/debug_swarm_write.rs:355 — crates/jcode-app-core/src/server/debug_swarm_write.rs:355-373 | crates/jcode-app-core/src/server/debug_swarm_write.rs:463-481 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/tool/communicate.rs:2813 — crates/jcode-app-core/src/tool/communicate.rs:2813-2831 | crates/jcode-app-core/src/tool/communicate.rs:2867-2885 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/usage_openai.rs:243 — crates/jcode-app-core/src/usage_openai.rs:243-261 | crates/jcode-base/src/usage/openai_helpers.rs:257-275 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) crates/jcode-base/src/session.rs:810 — crates/jcode-base/src/session.rs:810-828 | crates/jcode-base/src/session.rs:868-886 — both copies are in the same file, so extract the block into 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/jcode-render-core/src/preprocess.rs:505 — crates/jcode-render-core/src/preprocess.rs:505-523 | crates/jcode-render-core/src/preprocess.rs:615-633 — both copies are in the same file, so extract the block into 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/jcode-telemetry-core/src/lib.rs:419 — crates/jcode-telemetry-core/src/lib.rs:419-437 | crates/jcode-telemetry-core/src/lib.rs:2077-2095 — both copies are in the same file, so extract the block into 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/jcode-tui/src/video_export.rs:144 — crates/jcode-tui/src/video_export.rs:144-162 | crates/jcode-tui/src/video_export.rs:222-240 — both copies are in the same file, so extract the 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–17 lines × 2) · ×9
  • Duplicated block (16–17 lines × 2) crates/jcode-app-core/src/tool/webfetch.rs:308 — crates/jcode-app-core/src/tool/webfetch.rs:308-323 | crates/jcode-app-core/src/tool/webfetch.rs:390-406 — both copies are in the same file, so extract the block into 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/jcode-base/src/platform.rs:410 — crates/jcode-base/src/platform.rs:410-426 | crates/jcode-desktop-open/src/lib.rs:81-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/provider/dispatch.rs:84 — crates/jcode-base/src/provider/dispatch.rs:84-99 | crates/jcode-base/src/provider/dispatch.rs:222-238 — both copies are in the same file, so extract the block into 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/jcode-base/src/provider/dispatch.rs:114 — crates/jcode-base/src/provider/dispatch.rs:114-129 | crates/jcode-base/src/provider/dispatch.rs:264-280 — both copies are in the same file, so extract the block into 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/jcode-base/src/provider/dispatch.rs:131 — crates/jcode-base/src/provider/dispatch.rs:131-146 | crates/jcode-base/src/provider/dispatch.rs:287-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/session.rs:1593 — crates/jcode-base/src/session.rs:1593-1608 | crates/jcode-base/src/session.rs:1624-1640 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/remote/key_handling.rs:1486 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1486-1501 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1513-1529 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui/copy_selection.rs:177 — crates/jcode-tui/src/tui/ui/copy_selection.rs:177-193 | crates/jcode-tui/src/tui/ui/copy_selection.rs:304-319 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui_prepare.rs:2513 — crates/jcode-tui/src/tui/ui_prepare.rs:2513-2529 | crates/jcode-tui/src/tui/ui_prepare.rs:2633-2648 — both copies are in the same file, so extract the 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–11 lines × 2) · ×9
  • Duplicated block (10–11 lines × 2) crates/jcode-app-core/src/notifications.rs:717 — crates/jcode-app-core/src/notifications.rs:717-726 | crates/jcode-setup-hints/src/cli_launch_hints.rs:341-351 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10–11 lines × 2) crates/jcode-base/src/embedding_stub.rs:215 — crates/jcode-base/src/embedding_stub.rs:215-224 | crates/jcode-embedding/src/lib.rs:409-419 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1396 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1396-1406 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1917-1926 — both copies are in the same file, so extract the block into 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/jcode-tui-markdown/src/markdown_render_support.rs:361 — crates/jcode-tui-markdown/src/markdown_render_support.rs:361-371 | crates/jcode-tui-render/src/memory_tiles.rs:131-140 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-tui-render/src/swarm_gallery.rs:397 — crates/jcode-tui-render/src/swarm_gallery.rs:397-407 | crates/jcode-tui-render/src/swarm_gallery.rs:452-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) crates/jcode-tui/src/tui/info_widget.rs:1939 — crates/jcode-tui/src/tui/info_widget.rs:1939-1948 | crates/jcode-tui/src/tui/info_widget.rs:1999-2009 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/session_picker/loading.rs:2631 — crates/jcode-tui/src/tui/session_picker/loading.rs:2631-2641 | crates/jcode-tui/src/tui/session_picker/loading.rs:2714-2723 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui_messages.rs:4125 — crates/jcode-tui/src/tui/ui_messages.rs:4125-4135 | crates/jcode-tui/src/tui/ui_messages.rs:4153-4162 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/ui_viewport.rs:1048 — crates/jcode-tui/src/tui/ui_viewport.rs:1048-1058 | crates/jcode-tui/src/tui/ui_viewport.rs:1246-1255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×9
  • Duplicated block (5 lines × 3) crates/jcode-base/src/gmail.rs:568 — crates/jcode-base/src/gmail.rs:568-573 | crates/jcode-base/src/gmail.rs:628-632 | crates/jcode-base/src/gmail.rs:682-687 — 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/jcode-base/src/session/memory_profile.rs:92 — crates/jcode-base/src/session/memory_profile.rs:92-96 | crates/jcode-tui/src/tui/app/debug.rs:376-380 | crates/jcode-tui/src/tui/memory_profile.rs:219-223 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/jcode-base/src/transcript_sample.rs:426 — crates/jcode-base/src/transcript_sample.rs:426-430 | crates/jcode-base/src/transcript_sample.rs:450-454 | crates/jcode-base/src/transcript_sample.rs:578-582 — 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/jcode-tui/src/tui/app/observe.rs:59 — crates/jcode-tui/src/tui/app/observe.rs:59-63 | crates/jcode-tui/src/tui/app/split_view.rs:31-35 | crates/jcode-tui/src/tui/app/todos_view.rs:247-251 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/jcode-app-core/src/usage_display.rs:171 — crates/jcode-app-core/src/usage_display.rs:171-175 | crates/jcode-base/src/usage/display.rs:175-181 | crates/jcode-tui-usage-overlay/src/lib.rs:775-781 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 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) scripts/check_code_size_budget.py:83 — scripts/check_code_size_budget.py:83-87 | scripts/check_panic_budget.py:120-124 | scripts/check_test_size_budget.py:72-76 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) scripts/check_code_size_budget.py:90 — scripts/check_code_size_budget.py:90-95 | scripts/check_panic_budget.py:127-131 | scripts/check_test_size_budget.py:79-83 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 3) scripts/measure_animation_cpu_cost.py:145 — scripts/measure_animation_cpu_cost.py:145-149 | scripts/sweep_animation_fps.py:134-138 | scripts/why_no_animation_area.py:37-41 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/measure_animation_cpu_cost.py:142` calls `add_argument` and `scripts/why_no_animation_area.py:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:12 — crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:12-16 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_prefix.rs:67-71 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.rs:172-176 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D1 · Cyclomatic Complexity · SessionPicker · ×8
  • SessionPicker::build_preview_cache (cyclomatic 46) crates/jcode-tui/src/tui/session_picker.rs:1674 — SessionPicker::build_preview_cache 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.
  • SessionPicker::render_session_item_lines_at_frame (cyclomatic 32) crates/jcode-tui/src/tui/session_picker/render.rs:176 — SessionPicker::render_session_item_lines_at_frame has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SessionPicker::handle_overlay_key (cyclomatic 28) crates/jcode-tui/src/tui/session_picker.rs:1252 — SessionPicker::handle_overlay_key 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.
  • SessionPicker::run_with_session_updates (cyclomatic 24) crates/jcode-tui/src/tui/session_picker.rs:2542 — SessionPicker::run_with_session_updates 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.
  • SessionPicker::render_session_list (cyclomatic 22) crates/jcode-tui/src/tui/session_picker/render.rs:428 — SessionPicker::render_session_list 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.
  • SessionPicker::rebuild_items (cyclomatic 21) crates/jcode-tui/src/tui/session_picker/filter.rs:184 — SessionPicker::rebuild_items 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.
  • SessionPicker::render_preview (cyclomatic 19) crates/jcode-tui/src/tui/session_picker.rs:1373 — SessionPicker::render_preview 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.
  • SessionPicker::handle_search_key (cyclomatic 18) crates/jcode-tui/src/tui/session_picker.rs:1175 — SessionPicker::handle_search_key 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.
D2 · Cognitive Complexity · jcode_provider_cursor_runtime · ×8
  • jcode_provider_cursor_runtime::agent_transport::run_agent_turn (cognitive 167) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — jcode_provider_cursor_runtime::agent_transport::run_agent_turn has cognitive complexity 167 (threshold 15). Drivers by points: if/else 38 (111 pts), match/switch 9 (24 pts), loops 9 (23 pts), boolean chains 9 (nesting depth added 102). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::wire::decode_exec_server_message (cognitive 149) crates/jcode-provider-cursor-runtime/src/wire.rs:691 — jcode_provider_cursor_runtime::wire::decode_exec_server_message has cognitive complexity 149 (threshold 15). Drivers by points: if/else 31 (77 pts), loops 15 (43 pts), boolean chains 27, match/switch 1 (2 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::wire::decode_google_protobuf_value (cognitive 53) crates/jcode-provider-cursor-runtime/src/wire.rs:207 — jcode_provider_cursor_runtime::wire::decode_google_protobuf_value has cognitive complexity 53 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 4 (12 pts), boolean chains 6, 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.
  • jcode_provider_cursor_runtime::wire::decode_cursor_args_map (cognitive 37) crates/jcode-provider-cursor-runtime/src/wire.rs:506 — jcode_provider_cursor_runtime::wire::decode_cursor_args_map has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 3 (15 pts), if/else 5 (14 pts), boolean chains 4, loops 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.
  • jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog (cognitive 33) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:376 — jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::wire::extract_checkpoint_used_tokens (cognitive 24) crates/jcode-provider-cursor-runtime/src/wire.rs:1106 — jcode_provider_cursor_runtime::wire::extract_checkpoint_used_tokens has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::agent_transport::extract_answer_text (cognitive 18) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:657 — jcode_provider_cursor_runtime::agent_transport::extract_answer_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_provider_cursor_runtime::agent_transport::extract_thinking_text) 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.
  • jcode_provider_cursor_runtime::agent_transport::extract_thinking_text (cognitive 18) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:682 — jcode_provider_cursor_runtime::agent_transport::extract_thinking_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_provider_cursor_runtime::agent_transport::extract_answer_text) 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 · jcode_command_risk · ×8
  • jcode_command_risk::tokenize::tokenize (cognitive 83) crates/jcode-command-risk/src/tokenize.rs:95 — jcode_command_risk::tokenize::tokenize has cognitive complexity 83 (threshold 15). Drivers by points: if/else 22 (68 pts), loops 4 (11 pts), boolean chains 2, match/switch 1 (2 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.
  • jcode_command_risk::assess_segment (cognitive 71) crates/jcode-command-risk/src/lib.rs:238 — jcode_command_risk::assess_segment has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 15, loops 7 (11 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_command_risk::tokenize::heredoc_delimiters (cognitive 56) crates/jcode-command-risk/src/tokenize.rs:397 — jcode_command_risk::tokenize::heredoc_delimiters has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (43 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_command_risk::assess_find (cognitive 37) crates/jcode-command-risk/src/lib.rs:446 — jcode_command_risk::assess_find has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 3 (7 pts), boolean chains 2, match/switch 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.
  • jcode_command_risk::paths::classify_target (cognitive 19) crates/jcode-command-risk/src/paths.rs:193 — jcode_command_risk::paths::classify_target has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6 (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.
  • jcode_command_risk::tokenize::embedded_substitutions (cognitive 18) crates/jcode-command-risk/src/tokenize.rs:266 — jcode_command_risk::tokenize::embedded_substitutions 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.
  • jcode_command_risk::tokenize::scan_substitutions (cognitive 17) crates/jcode-command-risk/src/tokenize.rs:304 — jcode_command_risk::tokenize::scan_substitutions has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), boolean chains 4, if/else 1 (4 pts), 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.
  • jcode_command_risk::tokenize::matching_paren_body (cognitive 17) crates/jcode-command-risk/src/tokenize.rs:354 — jcode_command_risk::tokenize::matching_paren_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (5 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 · jcode_provider_anthropic · ×8
  • jcode_provider_anthropic::format_messages_with_native (cognitive 76) crates/jcode-provider-anthropic/src/lib.rs:50 — jcode_provider_anthropic::format_messages_with_native has cognitive complexity 76 (threshold 15). Drivers by points: if/else 20 (52 pts), loops 8 (16 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 43). 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.
  • jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools (cognitive 54) crates/jcode-provider-anthropic/src/history_repair.rs:443 — jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 4 (6 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results (cognitive 38) crates/jcode-provider-anthropic/src/history_repair.rs:244 — jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 4 (16 pts), if/else 7 (13 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::format_content_blocks_with_native (cognitive 34) crates/jcode-provider-anthropic/src/lib.rs:368 — jcode_provider_anthropic::format_content_blocks_with_native has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::history_repair::hoist_late_tool_results (cognitive 33) crates/jcode-provider-anthropic/src/history_repair.rs:12 — jcode_provider_anthropic::history_repair::hoist_late_tool_results has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 6 (12 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.
  • jcode_provider_anthropic::history_repair::apply_tool_references (cognitive 27) crates/jcode-provider-anthropic/src/history_repair.rs:155 — jcode_provider_anthropic::history_repair::apply_tool_references has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (5 pts), loops 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::add_message_cache_breakpoint (cognitive 24) crates/jcode-provider-anthropic/src/lib.rs:759 — jcode_provider_anthropic::add_message_cache_breakpoint has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::history_repair::answer_unpaired_tool_uses (cognitive 20) crates/jcode-provider-anthropic/src/history_repair.rs:351 — jcode_provider_anthropic::history_repair::answer_unpaired_tool_uses has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_import_core · ×8
  • jcode_import_core::extract_opencode_part_text (cognitive 33) crates/jcode-import-core/src/lib.rs:511 — jcode_import_core::extract_opencode_part_text has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_import_core::load_codex_external_session (cognitive 30) crates/jcode-import-core/src/lib.rs:643 — jcode_import_core::load_codex_external_session has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 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.
  • jcode_import_core::ordered_claude_code_message_entries (cognitive 24) crates/jcode-import-core/src/lib.rs:288 — jcode_import_core::ordered_claude_code_message_entries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (5 pts), boolean chains 4, 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.
  • jcode_import_core::load_pi_external_session (cognitive 20) crates/jcode-import-core/src/lib.rs:734 — jcode_import_core::load_pi_external_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_import_core::load_opencode_external_session (cognitive 20) crates/jcode-import-core/src/lib.rs:826 — jcode_import_core::load_opencode_external_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 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.
  • jcode_import_core::tool_result_content_to_text (cognitive 18) crates/jcode-import-core/src/lib.rs:170 — jcode_import_core::tool_result_content_to_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_import_core::extract_external_text_from_json::visit (cognitive 18) crates/jcode-import-core/src/lib.rs:462 — jcode_import_core::extract_external_text_from_json::visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_import_core::extract_text_from_json_value::visit (cognitive 17) crates/jcode-import-core/src/lib.rs:1120 — jcode_import_core::extract_text_from_json_value::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×8
  • Duplicated block (21 lines × 2) crates/jcode-app-core/src/tool/discover.rs:612 — crates/jcode-app-core/src/tool/discover.rs:612-632 | crates/jcode-app-core/src/tool/discover.rs:638-658 — both copies are in the same file, so extract the block into 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/jcode-base/src/provider/openrouter.rs:106 — crates/jcode-base/src/provider/openrouter.rs:106-126 | crates/jcode-provider-openrouter-runtime/src/lib.rs:116-136 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 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/jcode-base/src/session.rs:367 — crates/jcode-base/src/session.rs:367-387 | crates/jcode-base/src/session.rs:406-426 — both copies are in the same file, so extract the block into 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/jcode-base/src/usage/model.rs:10 — crates/jcode-base/src/usage/model.rs:10-30 | crates/jcode-tui/src/tui/app/helpers.rs:703-723 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (21 lines × 2) crates/jcode-import-core/src/lib.rs:378 — crates/jcode-import-core/src/lib.rs:378-398 | crates/jcode-tui/src/tui/session_picker/loading.rs:707-727 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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/jcode-provider-cursor-runtime/src/agent_transport.rs:658 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:658-678 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:683-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:222 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:222-242 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:464-484 — both copies are in the same file, so extract the block into 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) scripts/profile_remote_resume_burst.py:162 — scripts/profile_remote_resume_burst.py:162-182 | scripts/profile_single_spawn.py:148-168 — before extracting anything, compare `scripts/profile_remote_resume_burst.py` and `scripts/profile_single_spawn.py` as WHOLE FILES: this scan already matched 4 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. 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 lines × 2) · ×8
  • Duplicated block (20 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:3196 — crates/jcode-app-core/src/server/client_lifecycle.rs:3196-3215 | crates/jcode-app-core/src/server/client_lifecycle.rs:3292-3311 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/comm_control.rs:1786 — crates/jcode-app-core/src/server/comm_control.rs:1786-1805 | crates/jcode-app-core/src/server/comm_control.rs:1829-1848 — both copies are in the same file, so extract the block into 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/jcode-base/src/background.rs:949 — crates/jcode-base/src/background.rs:949-968 | crates/jcode-base/src/background.rs:1004-1023 — both copies are in the same file, so extract the block into 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/jcode-tui-core/src/graph_topology.rs:37 — crates/jcode-tui-core/src/graph_topology.rs:37-56 | crates/jcode-tui/src/tui/info_widget_text.rs:2-21 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:64 — crates/jcode-tui-markdown/src/markdown_render_full.rs:64-83 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:46-65 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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/jcode-tui-markdown/src/markdown_render_full.rs:1040 — crates/jcode-tui-markdown/src/markdown_render_full.rs:1040-1059 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:947-966 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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/jcode-tui/src/tui/app/auth.rs:803 — crates/jcode-tui/src/tui/app/auth.rs:803-822 | crates/jcode-tui/src/tui/app/auth.rs:1087-1106 — both copies are in the same file, so extract the block into 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/jcode-provider-doctor/src/provider_e2e.rs:530 — crates/jcode-provider-doctor/src/provider_e2e.rs:530-551 | crates/jcode-provider-doctor/src/provider_e2e.rs:826-845 — both copies are in the same file, so extract the 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) · ×8
  • Duplicated block (12 lines × 3) crates/jcode-app-core/src/server/client_actions.rs:333 — crates/jcode-app-core/src/server/client_actions.rs:333-344 | crates/jcode-app-core/src/server/client_actions.rs:531-542 | crates/jcode-app-core/src/server/client_actions.rs:546-557 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) crates/jcode-build-support/src/storage_helpers.rs:121 — crates/jcode-build-support/src/storage_helpers.rs:121-132 | crates/jcode-build-support/src/storage_helpers.rs:137-148 | crates/jcode-build-support/src/storage_helpers.rs:153-164 — 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/jcode-provider-copilot-runtime/src/lib.rs:119 — crates/jcode-provider-copilot-runtime/src/lib.rs:119-130 | crates/jcode-provider-cursor-runtime/src/lib.rs:448-459 | crates/jcode-provider-gemini-runtime/src/lib.rs:85-96 — 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 (12 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:463 — crates/jcode-tui-account-picker/src/overlay.rs:463-474 | crates/jcode-tui-usage-overlay/src/lib.rs:445-456 | crates/jcode-tui/src/tui/login_picker.rs:351-362 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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/jcode-tui/src/tui/app/turn.rs:911 — crates/jcode-tui/src/tui/app/turn.rs:911-922 | crates/jcode-tui/src/tui/app/turn.rs:1213-1224 | crates/jcode-tui/src/tui/app/turn.rs:1237-1248 — 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/jcode-tui/src/tui/app/commands.rs:1090 — crates/jcode-tui/src/tui/app/commands.rs:1090-1101 | crates/jcode-tui/src/tui/app/commands.rs:3932-3944 | crates/jcode-tui/src/tui/app/commands.rs:3976-3987 — 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/jcode-app-core/src/tool/discover.rs:1017 — crates/jcode-app-core/src/tool/discover.rs:1017-1028 | crates/jcode-app-core/src/tool/discover.rs:1208-1219 | crates/jcode-app-core/src/tool/discover.rs:1289-1300 — 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) scripts/measure_animation_cpu_cost.py:102 — scripts/measure_animation_cpu_cost.py:102-113 | scripts/repro_real_spawn_lag.py:190-201 | scripts/sweep_animation_fps.py:93-104 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/measure_animation_cpu_cost.py:117` calls `round`, `load_average` and `scripts/sweep_animation_fps.py:108` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×8
  • Duplicated block (8 lines × 4) crates/jcode-app-core/src/tool/read.rs:410 — crates/jcode-app-core/src/tool/read.rs:410-417 | crates/jcode-base/src/provider/image_clamp.rs:413-420 | crates/jcode-terminal-image/src/display.rs:238-245 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:280-287 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.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. 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 × 4) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1244 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1244-1251 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1309-1316 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1341-1348 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1351-1358 — 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 (8 lines × 4) crates/jcode-tui/src/tui/app/state_ui.rs:448 — crates/jcode-tui/src/tui/app/state_ui.rs:448-455 | crates/jcode-tui/src/tui/app/state_ui.rs:458-465 | crates/jcode-tui/src/tui/app/state_ui.rs:468-475 | crates/jcode-tui/src/tui/app/state_ui.rs:500-507 — 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 (8 lines × 4) crates/jcode-core/src/panic_util.rs:2 — crates/jcode-core/src/panic_util.rs:2-9 | crates/jcode-pdf/src/lib.rs:23-30 | crates/jcode-tui-mermaid/src/lib.rs:195-202 | src/cli/terminal.rs:225-232 — 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) scripts/check_code_size_budget.py:41 — scripts/check_code_size_budget.py:41-48 | scripts/check_panic_budget.py:40-47 | scripts/check_swallowed_error_budget.py:47-54 | scripts/check_test_size_budget.py:32-39 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 4) scripts/diagnose_idle_render_cost.py:227 — scripts/diagnose_idle_render_cost.py:227-234 | scripts/repro_input_flicker.py:305-312 | scripts/repro_input_lag.py:280-287 | scripts/repro_slash_flicker.py:245-252 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/repro_input_flicker.py:304` calls `setdefault` and `scripts/diagnose_idle_render_cost.py:226` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) scripts/diagnose_idle_render_cost.py:241 — scripts/diagnose_idle_render_cost.py:241-248 | scripts/repro_input_flicker.py:321-328 | scripts/repro_input_lag.py:294-301 | scripts/repro_slash_flicker.py:259-266 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 60.0` in one and `float = 40.0` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 4) ios/TestHarness/reward/scorers/consistency.py:132 — ios/TestHarness/reward/scorers/consistency.py:132-139 | ios/TestHarness/reward/scorers/rhythm.py:114-121 | ios/TestHarness/reward/scorers/simplicity.py:309-316 | ios/TestHarness/reward/scorers/styling.py:267-274 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · jcode_provider_core · ×7
  • jcode_provider_core::pricing::openai_api_pricing_with_tier (cyclomatic 34) crates/jcode-provider-core/src/pricing.rs:158 — jcode_provider_core::pricing::openai_api_pricing_with_tier 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.
  • jcode_provider_core::models::open_weight_family_context_limit (cyclomatic 32) crates/jcode-provider-core/src/models.rs:361 — jcode_provider_core::models::open_weight_family_context_limit has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_provider_core::model_names::pretty_picker_model_name (cyclomatic 22) crates/jcode-provider-core/src/model_names.rs:401 — jcode_provider_core::model_names::pretty_picker_model_name 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.
  • jcode_provider_core::openai_schema::schema_supports_strict::check_map (cyclomatic 20) crates/jcode-provider-core/src/openai_schema.rs:43 — jcode_provider_core::openai_schema::schema_supports_strict::check_map 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.
  • jcode_provider_core::model_names::pretty_picker_token (cyclomatic 17) crates/jcode-provider-core/src/model_names.rs:511 — jcode_provider_core::model_names::pretty_picker_token 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.
  • jcode_provider_core::models::context_limit_for_model_with_provider_and_cache (cyclomatic 17) crates/jcode-provider-core/src/models.rs:241 — jcode_provider_core::models::context_limit_for_model_with_provider_and_cache 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.
  • jcode_provider_core::reasoning::inferred_reasoning_efforts (cyclomatic 16) crates/jcode-provider-core/src/reasoning.rs:39 — jcode_provider_core::reasoning::inferred_reasoning_efforts 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 · jcode_render_core · ×7
  • jcode_render_core::markdown::parse_markdown (cognitive 125) crates/jcode-render-core/src/markdown.rs:141 — jcode_render_core::markdown::parse_markdown has cognitive complexity 125 (threshold 15). Drivers by points: if/else 46 (104 pts), match/switch 4 (11 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::preprocess::normalize_latex_delimiters_and_environments (cognitive 99) crates/jcode-render-core/src/preprocess.rs:417 — jcode_render_core::preprocess::normalize_latex_delimiters_and_environments has cognitive complexity 99 (threshold 15). Drivers by points: if/else 32 (78 pts), boolean chains 16, match/switch 1 (4 pts), loops 1 (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.
  • jcode_render_core::preprocess::escape_currency_dollars (cognitive 71) crates/jcode-render-core/src/preprocess.rs:773 — jcode_render_core::preprocess::escape_currency_dollars has cognitive complexity 71 (threshold 15). Drivers by points: if/else 22 (48 pts), loops 6 (13 pts), boolean chains 10 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::wrap::wrap_line (cognitive 38) crates/jcode-render-core/src/wrap.rs:44 — jcode_render_core::wrap::wrap_line has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::preprocess::normalize_math_fences (cognitive 25) crates/jcode-render-core/src/preprocess.rs:305 — jcode_render_core::preprocess::normalize_math_fences has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::math::split_matrix (cognitive 18) crates/jcode-render-core/src/math.rs:661 — jcode_render_core::math::split_matrix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::preprocess::stabilize_display_math (cognitive 18) crates/jcode-render-core/src/preprocess.rs:135 — jcode_render_core::preprocess::stabilize_display_math has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BedrockProvider · ×7
  • BedrockProvider::complete (cognitive 53) crates/jcode-provider-bedrock/src/lib.rs:1241 — BedrockProvider::complete has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (40 pts), match/switch 4 (11 pts), boolean chains 1, loops 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.
  • BedrockProvider::bedrock_input_schema (cognitive 39) crates/jcode-provider-bedrock/src/lib.rs:465 — BedrockProvider::bedrock_input_schema has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 5 (14 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.
  • BedrockProvider::refresh_catalog (cognitive 38) crates/jcode-provider-bedrock/src/lib.rs:1125 — BedrockProvider::refresh_catalog has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 3 (7 pts), boolean chains 3, 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.
  • BedrockProvider::classify_error_message (cognitive 22) crates/jcode-provider-bedrock/src/lib.rs:366 — BedrockProvider::classify_error_message has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • BedrockProvider::to_bedrock_messages (cognitive 21) crates/jcode-provider-bedrock/src/lib.rs:558 — BedrockProvider::to_bedrock_messages has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (8 pts), loops 1 (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.
  • BedrockProvider::all_display_models (cognitive 21) crates/jcode-provider-bedrock/src/lib.rs:1086 — BedrockProvider::all_display_models has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (5 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.
  • BedrockProvider::model_info (cognitive 19) crates/jcode-provider-bedrock/src/lib.rs:932 — BedrockProvider::model_info has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, 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 · jcode_setup_hints · ×7
  • jcode_setup_hints::windows_setup::windows_native_hotkey_loop (cognitive 36) crates/jcode-setup-hints/src/windows_setup.rs:436 — jcode_setup_hints::windows_setup::windows_native_hotkey_loop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 4, 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.
  • jcode_setup_hints::windows_setup::copilot_keyboard_hook (cognitive 34) crates/jcode-setup-hints/src/windows_setup.rs:384 — jcode_setup_hints::windows_setup::copilot_keyboard_hook has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (29 pts), boolean chains 5 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_setup_hints::windows_setup::run_setup_hotkey_windows (cognitive 31) crates/jcode-setup-hints/src/windows_setup.rs:968 — jcode_setup_hints::windows_setup::run_setup_hotkey_windows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 2 (5 pts), boolean chains 4, 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.
  • jcode_setup_hints::keymap::conflicts::jcode_bindings (cognitive 25) crates/jcode-setup-hints/src/keymap/conflicts.rs:93 — jcode_setup_hints::keymap::conflicts::jcode_bindings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (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.
  • jcode_setup_hints::run_setup_hotkey (cognitive 22) crates/jcode-setup-hints/src/lib.rs:689 — jcode_setup_hints::run_setup_hotkey has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (3 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.
  • jcode_setup_hints::keymap::terminal::split_trigger_tokens (cognitive 17) crates/jcode-setup-hints/src/keymap/terminal.rs:96 — jcode_setup_hints::keymap::terminal::split_trigger_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_setup_hints::install_xfce_launch_hotkeys (cognitive 16) crates/jcode-setup-hints/src/lib.rs:2000 — jcode_setup_hints::install_xfce_launch_hotkeys has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×7
  • Duplicated block (11–12 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:410 — crates/jcode-tui-markdown/src/markdown_render_full.rs:410-421 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:380-390 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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–12 lines × 2) crates/jcode-tui-mermaid/src/lib.rs:1130 — crates/jcode-tui-mermaid/src/lib.rs:1130-1141 | crates/jcode-tui-mermaid/src/lib.rs:1235-1245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) crates/jcode-tui/src/tui/ui_prepare.rs:2479 — crates/jcode-tui/src/tui/ui_prepare.rs:2479-2490 | crates/jcode-tui/src/tui/ui_prepare.rs:2599-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 (11–12 lines × 2) src/bin/memory_recall_bench.rs:520 — src/bin/memory_recall_bench.rs:520-531 | src/bin/memory_recall_bench.rs:2296-2306 — both copies are in the same file, so extract the block into 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) src/bin/memory_recall_bench.rs:878 — src/bin/memory_recall_bench.rs:878-889 | src/bin/memory_recall_bench.rs:1197-1207 — both copies are in the same file, so extract the block into 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) src/cli/commands/provider_setup.rs:473 — src/cli/commands/provider_setup.rs:473-484 | src/cli/commands/provider_setup.rs:488-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:511 — crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:511-521 | crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:527-538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×7
  • Duplicated block (8–9 lines × 2) crates/jcode-app-core/src/agent/response_recovery.rs:61 — crates/jcode-app-core/src/agent/response_recovery.rs:61-68 | crates/jcode-provider-openai/src/stream.rs:137-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/jcode-app-core/src/agent/turn_streaming_mpsc.rs:759 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:759-766 | crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:789-797 — both copies are in the same file, so extract the block into 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/jcode-app-core/src/server/comm_control.rs:1050 — crates/jcode-app-core/src/server/comm_control.rs:1050-1058 | crates/jcode-app-core/src/server/comm_session.rs:1513-1520 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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–9 lines × 2) crates/jcode-render-core/src/markdown.rs:447 — crates/jcode-render-core/src/markdown.rs:447-454 | crates/jcode-render-core/src/markdown.rs:462-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) crates/jcode-tui/src/tui/app/debug.rs:369 — crates/jcode-tui/src/tui/app/debug.rs:369-376 | crates/jcode-tui/src/tui/memory_profile.rs:211-219 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8–9 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:276 — crates/jcode-tui/src/tui/app/turn.rs:276-283 | crates/jcode-tui/src/tui/app/turn.rs:371-379 — both copies are in the same file, so extract the block into 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) src/bin/memory_recall_bench.rs:2611 — src/bin/memory_recall_bench.rs:2611-2619 | src/bin/memory_recall_bench.rs:2621-2628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×7
  • Duplicated block (7–8 lines × 2) crates/jcode-app-core/src/server/debug.rs:281 — crates/jcode-app-core/src/server/debug.rs:281-288 | crates/jcode-companion/src/server.rs:269-275 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7–8 lines × 2) crates/jcode-base/src/memory_log.rs:416 — crates/jcode-base/src/memory_log.rs:416-422 | crates/jcode-logging/src/lib.rs:611-618 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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–8 lines × 2) crates/jcode-provider-openrouter/src/lib.rs:529 — crates/jcode-provider-openrouter/src/lib.rs:529-536 | crates/jcode-provider-openrouter/src/lib.rs:639-645 — both copies are in the same file, so extract the block into 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/jcode-tui-render/src/memory_tiles.rs:265 — crates/jcode-tui-render/src/memory_tiles.rs:265-271 | crates/jcode-tui-render/src/memory_tiles.rs:277-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:3605 — crates/jcode-tui/src/tui/app/inline_interactive.rs:3605-3612 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3650-3656 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/remote/key_handling.rs:1441 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1441-1448 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1466-1472 — both copies are in the same file, so extract the block into 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) src/cli/login.rs:1103 — src/cli/login.rs:1103-1109 | src/cli/login/scriptable.rs:585-592 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×7
  • Duplicated block (7 lines × 3) crates/jcode-base/src/auth/codex.rs:542 — crates/jcode-base/src/auth/codex.rs:542-548 | crates/jcode-base/src/auth/codex.rs:555-561 | crates/jcode-base/src/auth/codex.rs:573-579 — 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/jcode-provider-bedrock/src/lib.rs:499 — crates/jcode-provider-bedrock/src/lib.rs:499-505 | crates/jcode-schema-dialect/src/dialect.rs:328-334 | crates/jcode-schema-dialect/src/dialect.rs:503-509 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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 (7 lines × 3) crates/jcode-render-core/src/markdown.rs:142 — crates/jcode-render-core/src/markdown.rs:142-148 | crates/jcode-tui-markdown/src/markdown_render_full.rs:74-80 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:56-62 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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) crates/jcode-tui/src/tui/app/turn.rs:450 — crates/jcode-tui/src/tui/app/turn.rs:450-456 | crates/jcode-tui/src/tui/app/turn.rs:509-515 | crates/jcode-tui/src/tui/app/turn.rs:1523-1529 — 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/jcode-app-core/src/server/debug_command_exec.rs:456 — crates/jcode-app-core/src/server/debug_command_exec.rs:456-462 | crates/jcode-app-core/src/server/debug_command_exec.rs:498-504 | crates/jcode-app-core/src/server/debug_command_exec.rs:524-530 — 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/check_donut_animates_live.py:58 — scripts/check_donut_animates_live.py:58-64 | scripts/repro_slash_flicker.py:326-332 | scripts/verify_donut_still_animates.py:58-64 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/verify_donut_still_animates.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 141 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) scripts/jcode_harbor_agent.py:43 — scripts/jcode_harbor_agent.py:43-49 | scripts/jcode_harbor_claude_agent.py:45-51 | scripts/run_terminal_bench_campaign.py:37-43 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `candidates` to `tuple[str | None, ...]` in one and `list[str | None]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D1 · Cyclomatic Complexity · Agent · ×6
  • Agent::run_turn_streaming_mpsc (cyclomatic 181) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:225 — Agent::run_turn_streaming_mpsc has cyclomatic complexity 181 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Agent::run_turn (cyclomatic 160) crates/jcode-app-core/src/agent/turn_loops.rs:56 — Agent::run_turn has cyclomatic complexity 160 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Agent::extract_session_memories (cyclomatic 21) crates/jcode-app-core/src/agent/turn_execution.rs:1465 — Agent::extract_session_memories 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.
  • Agent::export_conversation_markdown (cyclomatic 16) crates/jcode-app-core/src/agent/messages.rs:166 — Agent::export_conversation_markdown 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.
  • Agent::validate_tool_allowed (cyclomatic 16) crates/jcode-app-core/src/agent/turn_execution.rs:1079 — Agent::validate_tool_allowed 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.
  • Agent::repair_missing_tool_outputs (cyclomatic 16) crates/jcode-app-core/src/agent.rs:1103 — Agent::repair_missing_tool_outputs 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 · jcode_tui_markdown · ×6
  • jcode_tui_markdown::markdown_render_full::render_markdown_with_width (cyclomatic 149) crates/jcode-tui-markdown/src/markdown_render_full.rs:20 — jcode_tui_markdown::markdown_render_full::render_markdown_with_width has cyclomatic complexity 149 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy (cyclomatic 141) crates/jcode-tui-markdown/src/markdown_render_lazy.rs:3 — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy has cyclomatic complexity 141 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars (cyclomatic 29) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3 — jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars 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.
  • jcode_tui_markdown::markdown_wrap::wrap_line (cyclomatic 28) crates/jcode-tui-markdown/src/markdown_wrap.rs:5 — jcode_tui_markdown::markdown_wrap::wrap_line 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.
  • jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines (cyclomatic 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:10 — jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines 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.
  • jcode_tui_markdown::markdown_render_support::render_table_aligned (cyclomatic 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:168 — jcode_tui_markdown::markdown_render_support::render_table_aligned 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.
D2 · Cognitive Complexity · jcode_provider_openai · ×6
  • jcode_provider_openai::request::build_responses_input_with_logger (cognitive 158) crates/jcode-provider-openai/src/request.rs:195 — jcode_provider_openai::request::build_responses_input_with_logger has cognitive complexity 158 (threshold 15). Drivers by points: if/else 49 (121 pts), loops 11 (18 pts), match/switch 4 (13 pts), boolean chains 6 (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai::stream::parse_openai_response_event (cognitive 53) crates/jcode-provider-openai/src/stream.rs:440 — jcode_provider_openai::stream::parse_openai_response_event has cognitive complexity 53 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 6, match/switch 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai::citations::render_annotated_text (cognitive 52) crates/jcode-provider-openai/src/citations.rs:8 — jcode_provider_openai::citations::render_annotated_text has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (37 pts), loops 5 (8 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai::stream::handle_openai_output_item (cognitive 36) crates/jcode-provider-openai/src/stream.rs:743 — jcode_provider_openai::stream::handle_openai_output_item has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 6, loops 2 (6 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.
  • jcode_provider_openai::request::insert_additional_tools (cognitive 20) crates/jcode-provider-openai/src/request.rs:87 — jcode_provider_openai::request::insert_additional_tools has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (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.
  • jcode_provider_openai::stream::parse_text_wrapped_tool_call (cognitive 17) crates/jcode-provider-openai/src/stream.rs:108 — jcode_provider_openai::stream::parse_text_wrapped_tool_call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 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.
D2 · Cognitive Complexity · jcode_schema_dialect · ×6
  • jcode_schema_dialect::dialect::walk (cognitive 49) crates/jcode-schema-dialect/src/dialect.rs:168 — jcode_schema_dialect::dialect::walk has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 5 (15 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_schema_dialect::dialect::flatten_top_level_combiners (cognitive 43) crates/jcode-schema-dialect/src/dialect.rs:291 — jcode_schema_dialect::dialect::flatten_top_level_combiners has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 5 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_schema_dialect::conformance::walk (cognitive 38) crates/jcode-schema-dialect/src/conformance.rs:144 — jcode_schema_dialect::conformance::walk has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (14 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_schema_dialect::dialect::flatten_all_combiners (cognitive 38) crates/jcode-schema-dialect/src/dialect.rs:384 — jcode_schema_dialect::dialect::flatten_all_combiners has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 4 (17 pts), loops 3 (12 pts), if/else 2 (8 pts), boolean chains 1 (nesting depth added 28). 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.
  • jcode_schema_dialect::dialect::merge_all_of_branches (cognitive 24) crates/jcode-schema-dialect/src/dialect.rs:458 — jcode_schema_dialect::dialect::merge_all_of_branches has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (7 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.
  • jcode_schema_dialect::conformance::untyped_properties::walk (cognitive 17) crates/jcode-schema-dialect/src/conformance.rs:55 — jcode_schema_dialect::conformance::untyped_properties::walk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 pts), 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 · jcode_telemetry_core · ×6
  • jcode_telemetry_core::mark_tool_feature_usage (cognitive 38) crates/jcode-telemetry-core/src/lib.rs:1075 — jcode_telemetry_core::mark_tool_feature_usage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 2, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_telemetry_core::oauth_account::handle_in (cognitive 38) crates/jcode-telemetry-core/src/oauth_account.rs:287 — jcode_telemetry_core::oauth_account::handle_in has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_telemetry_core::record_tool_execution (cognitive 28) crates/jcode-telemetry-core/src/lib.rs:2662 — jcode_telemetry_core::record_tool_execution has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 2, match/switch 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.
  • jcode_telemetry_core::lifecycle::emit_lifecycle_event (cognitive 22) crates/jcode-telemetry-core/src/lifecycle.rs:3 — jcode_telemetry_core::lifecycle::emit_lifecycle_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 9, 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.
  • jcode_telemetry_core::session_outcome::infer_session_stop_reason (cognitive 22) crates/jcode-telemetry-core/src/session_outcome.rs:41 — jcode_telemetry_core::session_outcome::infer_session_stop_reason has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, 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.
  • jcode_telemetry_core::mark_tool_success_side_effects (cognitive 18) crates/jcode-telemetry-core/src/lib.rs:1179 — jcode_telemetry_core::mark_tool_success_side_effects has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 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 · jcode_sdk · ×6
  • jcode_sdk::launch::launch_instance (cognitive 34) crates/jcode-sdk/src/launch.rs:175 — jcode_sdk::launch::launch_instance has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4 (7 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_sdk::launch::inherit_credentials (cognitive 30) crates/jcode-sdk/src/launch.rs:373 — jcode_sdk::launch::inherit_credentials has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (9 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.
  • jcode_sdk::client::start_global_child (cognitive 20) crates/jcode-sdk/src/client.rs:1713 — jcode_sdk::client::start_global_child has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • jcode_sdk::client::discover_global_sessions (cognitive 16) crates/jcode-sdk/src/client.rs:1664 — jcode_sdk::client::discover_global_sessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (4 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.
  • jcode_sdk::client::spawn_reader (cognitive 16) crates/jcode-sdk/src/client.rs:1822 — jcode_sdk::client::spawn_reader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_sdk::structured::first_json_container (cognitive 16) crates/jcode-sdk/src/structured.rs:420 — jcode_sdk::structured::first_json_container has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D35 · Change Coupling · Change-coupling hub · ×6
  • Change-coupling hub: comm_requests.rs → client_lifecycle.rs, client_lightweight_control.rs, comm_control.rs, comm_session.rs, communicate.rs crates/jcode-app-core/src/protocol_tests/comm_requests.rs — `crates/jcode-app-core/src/protocol_tests/comm_requests.rs` changes together with 5 other files — `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-app-core/src/server/client_lightweight_control.rs`, `crates/jcode-app-core/src/server/comm_control.rs`, `crates/jcode-app-core/src/server/comm_session.rs`, `crates/jcode-app-core/src/tool/communicate.rs` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
  • Change-coupling hub: randomized.rs → client_api.rs, client_lifecycle.rs, backend.rs crates/jcode-protocol/src/protocol_tests/randomized.rs — `crates/jcode-protocol/src/protocol_tests/randomized.rs` changes together with 3 other files — `crates/jcode-app-core/src/server/client_api.rs`, `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-tui/src/tui/backend.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: comm_requests.rs → client_lifecycle.rs, client_lightweight_control.rs, comm_control.rs, comm_session.rs, communicate.rs crates/jcode-protocol/src/protocol_tests/comm_requests.rs — `crates/jcode-protocol/src/protocol_tests/comm_requests.rs` changes together with 5 other files — `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-app-core/src/server/client_lightweight_control.rs`, `crates/jcode-app-core/src/server/comm_control.rs`, `crates/jcode-app-core/src/server/comm_session.rs`, `crates/jcode-app-core/src/tool/communicate.rs` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
  • Change-coupling hub: misc_events.rs → client_api.rs, client_lifecycle.rs, translate.rs, backend.rs crates/jcode-app-core/src/protocol_tests/misc_events.rs — `crates/jcode-app-core/src/protocol_tests/misc_events.rs` changes together with 4 other files — `crates/jcode-app-core/src/server/client_api.rs`, `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-harness-api-server/src/translate.rs`, `crates/jcode-tui/src/tui/backend.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: translate.rs → client.rs, lib.rs, parity.rs crates/jcode-harness-api-server/src/translate.rs — `crates/jcode-harness-api-server/src/translate.rs` changes together with 3 other files — `crates/jcode-sdk/src/client.rs`, `crates/jcode-sdk/src/lib.rs`, `crates/jcode-sdk/src/sdk_tests/parity.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: input.rs → keybindings.rs, info_widget_tips.rs, ui_overlays.rs crates/jcode-tui/src/tui/app/input.rs — `crates/jcode-tui/src/tui/app/input.rs` changes together with 3 other files — `crates/jcode-config-types/src/keybindings.rs`, `crates/jcode-tui/src/tui/info_widget_tips.rs`, `crates/jcode-tui/src/tui/ui_overlays.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×6
  • Duplicated block (22 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1688 — crates/jcode-app-core/src/server/client_lifecycle.rs:1688-1709 | crates/jcode-app-core/src/server/client_lifecycle.rs:1954-1975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) crates/jcode-provider-openrouter/src/lib.rs:570 — crates/jcode-provider-openrouter/src/lib.rs:570-591 | crates/jcode-provider-openrouter/src/lib.rs:604-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) crates/jcode-tui-anim/src/lib.rs:241 — crates/jcode-tui-anim/src/lib.rs:241-262 | crates/jcode-tui-anim/src/lib.rs:347-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) crates/jcode-tui-style/src/color.rs:170 — crates/jcode-tui-style/src/color.rs:170-191 | crates/jcode-tui-workspace/src/color_support.rs:132-153 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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 (22 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:2865 — crates/jcode-tui/src/tui/ui_messages.rs:2865-2886 | crates/jcode-tui/src/tui/ui_messages.rs:3017-3038 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) src/cli/commands.rs:268 — src/cli/commands.rs:268-289 | src/cli/commands.rs:490-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 (6 lines × 4) · ×6
  • Duplicated block (6 lines × 4) crates/jcode-import-core/src/lib.rs:647 — crates/jcode-import-core/src/lib.rs:647-652 | crates/jcode-import-core/src/lib.rs:738-743 | crates/jcode-tui/src/tui/session_picker/loading.rs:2136-2141 | crates/jcode-tui/src/tui/session_picker/loading.rs:2331-2336 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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/jcode-tui/src/tui/app/remote/key_handling.rs:1441 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1441-1446 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1466-1472 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1491-1496 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1518-1524 — 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/jcode-tui/src/tui/ui.rs:2324 — crates/jcode-tui/src/tui/ui.rs:2324-2329 | crates/jcode-tui/src/tui/ui.rs:2351-2356 | crates/jcode-tui/src/tui/ui_file_diff.rs:17-22 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:17-22 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) crates/jcode-app-core/src/server/durable_state.rs:7 — crates/jcode-app-core/src/server/durable_state.rs:7-12 | crates/jcode-app-core/src/server/swarm_persistence.rs:139-144 | crates/jcode-todo-policy/src/await_dependency.rs:33-38 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:437-442 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (6 lines × 4) crates/jcode-tui/src/tui/app/hotkey_feedback.rs:666 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:666-671 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:159-164 | crates/jcode-tui/src/tui/app/subscribe_nudge.rs:88-93 | src/cli/cloud_move.rs:775-780 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (6 lines × 4) src/bin/memory_recall_bench.rs:1884 — src/bin/memory_recall_bench.rs:1884-1893 | src/bin/memory_recall_bench.rs:1900-1910 | src/bin/memory_recall_bench.rs:1952-1957 | src/bin/memory_recall_bench.rs:1982-1989 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D1 · Cyclomatic Complexity · jcode_render_core · ×5
  • jcode_render_core::markdown::parse_markdown (cyclomatic 87) crates/jcode-render-core/src/markdown.rs:141 — jcode_render_core::markdown::parse_markdown 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.
  • jcode_render_core::preprocess::normalize_latex_delimiters_and_environments (cyclomatic 50) crates/jcode-render-core/src/preprocess.rs:417 — jcode_render_core::preprocess::normalize_latex_delimiters_and_environments 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.
  • jcode_render_core::preprocess::escape_currency_dollars (cyclomatic 35) crates/jcode-render-core/src/preprocess.rs:773 — jcode_render_core::preprocess::escape_currency_dollars 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.
  • jcode_render_core::math::split_matrix (cyclomatic 18) crates/jcode-render-core/src/math.rs:661 — jcode_render_core::math::split_matrix 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. This is NOT this file's highest cyclomatic complexity: jcode_render_core::math::command_symbol (cyclomatic 141) 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.
  • jcode_render_core::wrap::wrap_line (cyclomatic 16) crates/jcode-render-core/src/wrap.rs:44 — jcode_render_core::wrap::wrap_line 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 · jcode_command_risk · ×5
  • jcode_command_risk::assess_segment (cyclomatic 45) crates/jcode-command-risk/src/lib.rs:238 — jcode_command_risk::assess_segment has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_command_risk::tokenize::tokenize (cyclomatic 36) crates/jcode-command-risk/src/tokenize.rs:95 — jcode_command_risk::tokenize::tokenize 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.
  • jcode_command_risk::tokenize::heredoc_delimiters (cyclomatic 31) crates/jcode-command-risk/src/tokenize.rs:397 — jcode_command_risk::tokenize::heredoc_delimiters 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.
  • jcode_command_risk::assess_find (cyclomatic 17) crates/jcode-command-risk/src/lib.rs:446 — jcode_command_risk::assess_find has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_command_risk::paths::classify_target (cyclomatic 16) crates/jcode-command-risk/src/paths.rs:193 — jcode_command_risk::paths::classify_target has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_telemetry_core · ×5
  • jcode_telemetry_core::mark_tool_feature_usage (cyclomatic 32) crates/jcode-telemetry-core/src/lib.rs:1075 — jcode_telemetry_core::mark_tool_feature_usage 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.
  • jcode_telemetry_core::session_outcome::infer_session_stop_reason (cyclomatic 23) crates/jcode-telemetry-core/src/session_outcome.rs:41 — jcode_telemetry_core::session_outcome::infer_session_stop_reason 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.
  • jcode_telemetry_core::lifecycle::emit_lifecycle_event (cyclomatic 22) crates/jcode-telemetry-core/src/lifecycle.rs:3 — jcode_telemetry_core::lifecycle::emit_lifecycle_event 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.
  • jcode_telemetry_core::oauth_account::handle_in (cyclomatic 22) crates/jcode-telemetry-core/src/oauth_account.rs:287 — jcode_telemetry_core::oauth_account::handle_in 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.
  • jcode_telemetry_core::record_tool_execution (cyclomatic 16) crates/jcode-telemetry-core/src/lib.rs:2662 — jcode_telemetry_core::record_tool_execution 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 · jcode_provider_anthropic · ×5
  • jcode_provider_anthropic::format_messages_with_native (cyclomatic 31) crates/jcode-provider-anthropic/src/lib.rs:50 — jcode_provider_anthropic::format_messages_with_native 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.
  • jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools (cyclomatic 24) crates/jcode-provider-anthropic/src/history_repair.rs:443 — jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools 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.
  • jcode_provider_anthropic::format_content_blocks_with_native (cyclomatic 20) crates/jcode-provider-anthropic/src/lib.rs:368 — jcode_provider_anthropic::format_content_blocks_with_native 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.
  • jcode_provider_anthropic::history_repair::hoist_late_tool_results (cyclomatic 16) crates/jcode-provider-anthropic/src/history_repair.rs:12 — jcode_provider_anthropic::history_repair::hoist_late_tool_results 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.
  • jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results (cyclomatic 16) crates/jcode-provider-anthropic/src/history_repair.rs:244 — jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results 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 · BedrockProvider · ×5
  • BedrockProvider::complete (cyclomatic 27) crates/jcode-provider-bedrock/src/lib.rs:1241 — BedrockProvider::complete 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.
  • BedrockProvider::classify_error_message (cyclomatic 22) crates/jcode-provider-bedrock/src/lib.rs:366 — BedrockProvider::classify_error_message 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.
  • BedrockProvider::refresh_catalog (cyclomatic 20) crates/jcode-provider-bedrock/src/lib.rs:1125 — BedrockProvider::refresh_catalog 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.
  • BedrockProvider::model_info (cyclomatic 19) crates/jcode-provider-bedrock/src/lib.rs:932 — BedrockProvider::model_info 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.
  • BedrockProvider::bedrock_input_schema (cyclomatic 16) crates/jcode-provider-bedrock/src/lib.rs:465 — BedrockProvider::bedrock_input_schema 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 · jcode_provider_openai_runtime · ×5
  • jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked (cognitive 153) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:867 — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked has cognitive complexity 153 (threshold 15). Drivers by points: if/else 65 (128 pts), boolean chains 12, match/switch 6 (9 pts), loops 2 (4 pts) (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated (cognitive 131) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1740 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated has cognitive complexity 131 (threshold 15). Drivers by points: if/else 31 (118 pts), match/switch 3 (6 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 93). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response (cognitive 52) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:430 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai_runtime::chatgpt_web::poll_for_response (cognitive 26) crates/jcode-provider-openai-runtime/src/chatgpt_web.rs:407 — jcode_provider_openai_runtime::chatgpt_web::poll_for_response has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai_runtime::openai_stream_runtime::recover_opaque_ws_rejection (cognitive 18) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:88 — jcode_provider_openai_runtime::openai_stream_runtime::recover_opaque_ws_rejection has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (8 pts), loops 1 (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.
D2 · Cognitive Complexity · OpenRouterProvider · ×5
  • OpenRouterProvider::complete (cognitive 52) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:38 — OpenRouterProvider::complete has cognitive complexity 52 (threshold 15). Drivers by points: if/else 30 (35 pts), boolean chains 12, loops 2 (5 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • OpenRouterProvider::available_models_display (cognitive 23) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:547 — OpenRouterProvider::available_models_display has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 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.
  • OpenRouterProvider::set_model (cognitive 21) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:397 — OpenRouterProvider::set_model has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (18 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.
  • OpenRouterProvider::apply_resolved_reasoning_effort (cognitive 17) crates/jcode-provider-openrouter-runtime/src/lib.rs:872 — OpenRouterProvider::apply_resolved_reasoning_effort has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OpenRouterProvider::effective_routing (cognitive 16) crates/jcode-provider-openrouter-runtime/src/lib.rs:2186 — OpenRouterProvider::effective_routing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 2 (5 pts), boolean chains 2 (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 · jcode_tui_style · ×5
  • jcode_tui_style::harmony::generate::separate_confusable_pairs (cognitive 51) crates/jcode-tui-style/src/harmony/generate.rs:217 — jcode_tui_style::harmony::generate::separate_confusable_pairs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 10 (20 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 24). Of this number, 37 points are the body's own statements and 14 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.
  • jcode_tui_style::theme_mode::adapt_buffer_impl (cognitive 30) crates/jcode-tui-style/src/theme_mode.rs:269 — jcode_tui_style::theme_mode::adapt_buffer_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 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.
  • jcode_tui_style::harmony::generate::generate_from_seed (cognitive 20) crates/jcode-tui-style/src/harmony/generate.rs:31 — jcode_tui_style::harmony::generate::generate_from_seed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18 (19 pts), loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui_style::harmony::chroma_coherence (cognitive 18) crates/jcode-tui-style/src/harmony.rs:539 — jcode_tui_style::harmony::chroma_coherence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_style::color::detect_raw_color_capability (cognitive 16) crates/jcode-tui-style/src/color.rs:94 — jcode_tui_style::color::detect_raw_color_capability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/jcode-app-core/src/tool/read.rs:401 — crates/jcode-app-core/src/tool/read.rs:401-442 | crates/jcode-base/src/provider/image_clamp.rs:404-443 | crates/jcode-terminal-image/src/display.rs:229-290 | crates/jcode-tui-mermaid/src/lib.rs:1544-1556 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:269-346 — 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/jcode-base/src/embedding_stub.rs:47 — crates/jcode-base/src/embedding_stub.rs:47-85 | crates/jcode-embedding/src/lib.rs:47-84 | crates/jcode-memory-types/src/graph.rs:50-87 | crates/jcode-memory-types/src/lib.rs:872-910 | crates/jcode-memory-types/src/lib.rs:945-983 — 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/jcode-tui/src/tui/keybind.rs:64 — crates/jcode-tui/src/tui/keybind.rs:64-83 | crates/jcode-tui/src/tui/keybind.rs:647-660 | crates/jcode-tui/src/tui/keybind.rs:664-677 | crates/jcode-tui/src/tui/keybind.rs:681-694 | crates/jcode-tui/src/tui/keybind.rs:698-711 — 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/jcode-tui/src/tui/ui.rs:2319 — crates/jcode-tui/src/tui/ui.rs:2319-2338 | crates/jcode-tui/src/tui/ui.rs:2346-2374 | crates/jcode-tui/src/tui/ui_file_diff.rs:9-41 | crates/jcode-tui/src/tui/ui_overlays.rs:20-136 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:9-41 — 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) scripts/diagnose_idle_render_cost.py:129 — scripts/diagnose_idle_render_cost.py:129-140 | scripts/repro_expand_edit_shortcut.py:287-300 | scripts/repro_input_flicker.py:140-151 | scripts/repro_input_lag.py:143-154 | scripts/repro_slash_flicker.py:136-147 — 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 (23 lines × 2) · ×5
  • Duplicated block (23 lines × 2) crates/jcode-app-core/src/message_notifications.rs:23 — crates/jcode-app-core/src/message_notifications.rs:23-45 | crates/jcode-base/src/message/notifications.rs:74-96 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 2) crates/jcode-app-core/src/server/background_tasks.rs:92 — crates/jcode-app-core/src/server/background_tasks.rs:92-114 | crates/jcode-app-core/src/server/background_tasks.rs:179-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) crates/jcode-app-core/src/tool/bg.rs:105 — crates/jcode-app-core/src/tool/bg.rs:105-127 | crates/jcode-tui/src/tui/ui_tools.rs:71-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (23 lines × 2) scripts/profile_remote_resume_burst.py:94 — scripts/profile_remote_resume_burst.py:94-116 | scripts/profile_single_spawn.py:44-66 — before extracting anything, compare `scripts/profile_remote_resume_burst.py` and `scripts/profile_single_spawn.py` as WHOLE FILES: this scan already matched 4 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `cwd` to `str = "."` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (23 lines × 2) scripts/repro_expand_edit_shortcut.py:198 — scripts/repro_expand_edit_shortcut.py:198-220 | scripts/repro_live_duplicate.py:168-190 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×5
  • Duplicated block (19–20 lines × 2) crates/jcode-base/src/compaction.rs:996 — crates/jcode-base/src/compaction.rs:996-1014 | crates/jcode-base/src/compaction.rs:1020-1039 — both copies are in the same file, so extract the block into 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–20 lines × 2) crates/jcode-base/src/import.rs:202 — crates/jcode-base/src/import.rs:202-221 | crates/jcode-base/src/import.rs:273-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) crates/jcode-base/src/import.rs:1239 — crates/jcode-base/src/import.rs:1239-1257 | crates/jcode-tui/src/tui/session_picker/loading.rs:2470-2489 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19–20 lines × 2) crates/jcode-tui/src/tui/app/run_shell.rs:729 — crates/jcode-tui/src/tui/app/run_shell.rs:729-748 | crates/jcode-tui/src/tui/app/run_shell.rs:973-991 — both copies are in the same file, so extract the block into 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–20 lines × 2) src/cli/auth_test/run.rs:28 — src/cli/auth_test/run.rs:28-46 | src/cli/auth_test/run.rs:73-92 — both copies are in the same file, so extract the 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–16 lines × 2) · ×5
  • Duplicated block (15–16 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1553 — crates/jcode-app-core/src/server/client_session.rs:1553-1568 | crates/jcode-app-core/src/server/client_session.rs:1715-1729 — both copies are in the same file, so extract the block into 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–16 lines × 2) crates/jcode-embedding/src/lib.rs:145 — crates/jcode-embedding/src/lib.rs:145-160 | crates/jcode-embedding/src/lib.rs:303-317 — both copies are in the same file, so extract the block into 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–16 lines × 2) crates/jcode-tui/src/tui/app/run_shell.rs:751 — crates/jcode-tui/src/tui/app/run_shell.rs:751-766 | crates/jcode-tui/src/tui/app/run_shell.rs:1010-1024 — both copies are in the same file, so extract the block into 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–16 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:480 — crates/jcode-tui/src/tui/app/turn.rs:480-495 | crates/jcode-tui/src/tui/app/turn.rs:1276-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 (15–16 lines × 2) scripts/repro_expand_edit_shortcut.py:435 — scripts/repro_expand_edit_shortcut.py:435-449 | scripts/repro_live_duplicate.py:445-460 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_live_duplicate.py:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×5
  • Duplicated block (14–15 lines × 2) crates/jcode-app-core/src/agent/turn_execution.rs:1325 — crates/jcode-app-core/src/agent/turn_execution.rs:1325-1338 | crates/jcode-app-core/src/agent/turn_execution.rs:1354-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/jcode-app-core/src/server/provider_control.rs:475 — crates/jcode-app-core/src/server/provider_control.rs:475-489 | crates/jcode-app-core/src/server/provider_control.rs:584-597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1231 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1231-1245 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1288-1301 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/app/remote/server_events.rs:3032 — crates/jcode-tui/src/tui/app/remote/server_events.rs:3032-3045 | crates/jcode-tui/src/tui/app/remote/server_events.rs:3146-3160 — both copies are in the same file, so extract the block into 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/jcode-tui/src/tui/info_widget_usage.rs:75 — crates/jcode-tui/src/tui/info_widget_usage.rs:75-89 | crates/jcode-tui/src/tui/info_widget_usage.rs:215-228 — both copies are in the same file, so extract the 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 × 4) · ×5
  • Duplicated block (12 lines × 4) crates/jcode-app-core/src/tool/read.rs:425 — crates/jcode-app-core/src/tool/read.rs:425-436 | crates/jcode-base/src/provider/image_clamp.rs:426-437 | crates/jcode-terminal-image/src/display.rs:253-264 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:298-309 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.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. 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 × 4) crates/jcode-base/src/import.rs:1464 — crates/jcode-base/src/import.rs:1464-1475 | crates/jcode-import-core/src/lib.rs:1045-1056 | crates/jcode-tui/src/tui/session_picker/loading.rs:2860-2871 | crates/jcode-tui/src/tui/session_picker/loading.rs:2911-2922 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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 × 4) crates/jcode-app-core/src/mission.rs:179 — crates/jcode-app-core/src/mission.rs:179-190 | crates/jcode-app-core/src/server/durable_state.rs:14-25 | crates/jcode-app-core/src/server/reload_recovery.rs:54-65 | crates/jcode-app-core/src/tool/selfdev/reload.rs:5-16 — 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 (12 lines × 4) scripts/pin_no_area_state.py:66 — scripts/pin_no_area_state.py:66-77 | scripts/profile_idle_donut.py:84-95 | scripts/which_overlay_blocks_donut.py:70-81 | scripts/why_no_animation_area.py:61-72 — before extracting anything, compare `scripts/pin_no_area_state.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 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 (12 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:454 — crates/jcode-provider-doctor/src/provider_e2e.rs:454-465 | crates/jcode-provider-doctor/src/provider_e2e.rs:747-758 | crates/jcode-provider-doctor/src/provider_e2e.rs:1104-1115 | crates/jcode-provider-doctor/src/provider_e2e.rs:1738-1749 — 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 (11 lines × 3) · ×5
  • Duplicated block (11 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:769 — crates/jcode-provider-doctor/src/live_provider_probes.rs:769-779 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1097-1107 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1288-1298 — 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/jcode-app-core/src/server/client_lifecycle.rs:968 — crates/jcode-app-core/src/server/client_lifecycle.rs:968-978 | crates/jcode-app-core/src/server/client_lifecycle.rs:1108-1119 | crates/jcode-app-core/src/server/client_lifecycle.rs:1130-1140 — 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/jcode-tui/src/tui/ui_onboarding.rs:460 — crates/jcode-tui/src/tui/ui_onboarding.rs:460-470 | crates/jcode-tui/src/tui/ui_onboarding.rs:497-507 | crates/jcode-tui/src/tui/ui_onboarding.rs:527-537 — 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) scripts/diagnose_idle_render_cost.py:223 — scripts/diagnose_idle_render_cost.py:223-233 | scripts/repro_input_lag.py:276-286 | scripts/repro_slash_flicker.py:241-251 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_lag.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 179 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) scripts/diagnose_idle_render_cost.py:332 — scripts/diagnose_idle_render_cost.py:332-342 | scripts/profile_idle_donut.py:65-75 | scripts/repro_slash_flicker.py:361-371 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 40 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 (9–11 lines × 2) · ×5
  • Duplicated block (9–11 lines × 2) crates/jcode-app-core/src/ambient/prompt.rs:124 — crates/jcode-app-core/src/ambient/prompt.rs:124-134 | crates/jcode-app-core/src/ambient/runner.rs:345-353 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–11 lines × 2) crates/jcode-base/src/auth/oauth.rs:236 — crates/jcode-base/src/auth/oauth.rs:236-244 | crates/jcode-base/src/auth/oauth.rs:346-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 (9–11 lines × 2) crates/jcode-compaction-core/src/lib.rs:617 — crates/jcode-compaction-core/src/lib.rs:617-625 | crates/jcode-compaction-core/src/lib.rs:639-649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–11 lines × 2) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:26 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:26-36 | crates/jcode-provider-copilot-runtime/src/routing.rs:37-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–11 lines × 2) crates/jcode-provider-openai-runtime/src/lib.rs:441 — crates/jcode-provider-openai-runtime/src/lib.rs:441-451 | crates/jcode-tui/src/tui/ui_input.rs:866-874 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) · ×5
  • Duplicated block (5 lines × 4) crates/jcode-app-core/src/server/comm_session.rs:39 — crates/jcode-app-core/src/server/comm_session.rs:39-43 | crates/jcode-app-core/src/server/swarm_persistence.rs:37-41 | crates/jcode-app-core/src/server/swarm_persistence.rs:50-54 | crates/jcode-base/src/usage/flight.rs:17-21 — 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.
  • Duplicated block (5 lines × 4) crates/jcode-app-core/src/tool/conversation_search.rs:208 — crates/jcode-app-core/src/tool/conversation_search.rs:208-212 | crates/jcode-base/src/memory_agent.rs:62-66 | crates/jcode-base/src/memory_prompt.rs:40-44 | crates/jcode-base/src/memory_prompt.rs:80-84 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 4) crates/jcode-base/src/embedding_stub.rs:81 — crates/jcode-base/src/embedding_stub.rs:81-85 | crates/jcode-embedding/src/lib.rs:80-84 | crates/jcode-memory-types/src/graph.rs:83-87 | crates/jcode-memory-types/src/lib.rs:906-910 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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/jcode-app-core/src/agent.rs:81 — crates/jcode-app-core/src/agent.rs:81-85 | crates/jcode-compaction-core/src/lib.rs:516-520 | crates/jcode-tui-markdown/src/markdown_math_copy.rs:48-52 | crates/jcode-tui/src/tui/app/cache_fingerprints.rs:3-7 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (5 lines × 4) crates/jcode-base/src/embedding_stub.rs:37 — crates/jcode-base/src/embedding_stub.rs:37-41 | crates/jcode-embedding/src/lib.rs:37-41 | crates/jcode-memory-types/src/graph.rs:40-44 | crates/jcode-memory-types/src/lib.rs:862-866 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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.
D1 · Cyclomatic Complexity · jcode_provider_cursor_runtime · ×4
  • jcode_provider_cursor_runtime::wire::decode_exec_server_message (cyclomatic 97) crates/jcode-provider-cursor-runtime/src/wire.rs:691 — jcode_provider_cursor_runtime::wire::decode_exec_server_message has cyclomatic complexity 97 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_provider_cursor_runtime::agent_transport::run_agent_turn (cyclomatic 90) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — jcode_provider_cursor_runtime::agent_transport::run_agent_turn 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.
  • jcode_provider_cursor_runtime::wire::decode_google_protobuf_value (cyclomatic 27) crates/jcode-provider-cursor-runtime/src/wire.rs:207 — jcode_provider_cursor_runtime::wire::decode_google_protobuf_value 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.
  • jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog (cyclomatic 20) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:376 — jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog 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 · jcode_provider_openai · ×4
  • jcode_provider_openai::request::build_responses_input_with_logger (cyclomatic 67) crates/jcode-provider-openai/src/request.rs:195 — jcode_provider_openai::request::build_responses_input_with_logger 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.
  • jcode_provider_openai::stream::parse_openai_response_event (cyclomatic 41) crates/jcode-provider-openai/src/stream.rs:440 — jcode_provider_openai::stream::parse_openai_response_event 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.
  • jcode_provider_openai::citations::render_annotated_text (cyclomatic 27) crates/jcode-provider-openai/src/citations.rs:8 — jcode_provider_openai::citations::render_annotated_text 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.
  • jcode_provider_openai::stream::handle_openai_output_item (cyclomatic 24) crates/jcode-provider-openai/src/stream.rs:743 — jcode_provider_openai::stream::handle_openai_output_item 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 · jcode_tui_render · ×4
  • jcode_tui_render::swarm_gallery::render_swarm_strip_vertical (cyclomatic 56) crates/jcode-tui-render/src/swarm_gallery.rs:957 — jcode_tui_render::swarm_gallery::render_swarm_strip_vertical has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui_render::swarm_gallery::render_swarm_strip (cyclomatic 46) crates/jcode-tui-render/src/swarm_gallery.rs:624 — jcode_tui_render::swarm_gallery::render_swarm_strip 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.
  • jcode_tui_render::memory_tiles::render_memory_tiles (cyclomatic 26) crates/jcode-tui-render/src/memory_tiles.rs:413 — jcode_tui_render::memory_tiles::render_memory_tiles 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.
  • jcode_tui_render::swarm_gallery::hovered_detail_body (cyclomatic 19) crates/jcode-tui-render/src/swarm_gallery.rs:1705 — jcode_tui_render::swarm_gallery::hovered_detail_body 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.
D2 · Cognitive Complexity · BridgeState · ×4
  • BridgeState::legacy_event_to_api (cognitive 180) crates/jcode-harness-api-server/src/translate.rs:1541 — BridgeState::legacy_event_to_api has cognitive complexity 180 (threshold 15). Drivers by points: if/else 65 (133 pts), boolean chains 22, match/switch 10 (19 pts), loops 3 (6 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.
  • BridgeState::translate_request (cognitive 164) crates/jcode-harness-api-server/src/translate.rs:382 — BridgeState::translate_request has cognitive complexity 164 (threshold 15). Drivers by points: if/else 57 (112 pts), match/switch 17 (32 pts), boolean chains 15, loops 2 (5 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BridgeState::walk_files (cognitive 27) crates/jcode-harness-api-server/src/translate.rs:3376 — BridgeState::walk_files has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BridgeState::search_session_text (cognitive 22) crates/jcode-harness-api-server/src/translate.rs:3449 — BridgeState::search_session_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 1, 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 · jcode_voice · ×4
  • jcode_voice::command_capture::run_recorder (cognitive 39) crates/jcode-voice/src/command_capture.rs:247 — jcode_voice::command_capture::run_recorder has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 5 (8 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_voice::streaming_capture::capture (cognitive 24) crates/jcode-voice/src/streaming_capture.rs:280 — jcode_voice::streaming_capture::capture has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2, loops 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.
  • jcode_voice::validate_wav (cognitive 20) crates/jcode-voice/src/lib.rs:231 — jcode_voice::validate_wav has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_voice::capture::run (cognitive 17) crates/jcode-voice/src/lib.rs:431 — jcode_voice::capture::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · BackgroundTaskManager · ×4
  • BackgroundTaskManager::cleanup_filtered (cognitive 38) crates/jcode-base/src/background.rs:1522 — BackgroundTaskManager::cleanup_filtered has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), match/switch 1 (4 pts), boolean chains 2, 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.
  • BackgroundTaskManager::wait (cognitive 37) crates/jcode-base/src/background.rs:900 — BackgroundTaskManager::wait has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (29 pts), match/switch 2 (5 pts), boolean chains 2, 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.
  • BackgroundTaskManager::arm_stall_watchdog (cognitive 20) crates/jcode-base/src/background.rs:1148 — BackgroundTaskManager::arm_stall_watchdog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 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.
  • BackgroundTaskManager::persisted_detached_running_tasks_for_session (cognitive 20) crates/jcode-base/src/background.rs:1634 — BackgroundTaskManager::persisted_detached_running_tasks_for_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SelfDevTool · ×4
  • SelfDevTool::do_setup (cognitive 24) crates/jcode-app-core/src/tool/selfdev/setup.rs:59 — SelfDevTool::do_setup has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 6 (9 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.
  • SelfDevTool::execute (cognitive 19) crates/jcode-app-core/src/tool/selfdev/mod.rs:589 — SelfDevTool::execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SelfDevTool::wait_for_turn (cognitive 17) crates/jcode-app-core/src/tool/selfdev/build_queue.rs:29 — SelfDevTool::wait_for_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelfDevTool::do_reload (cognitive 16) crates/jcode-app-core/src/tool/selfdev/reload.rs:282 — SelfDevTool::do_reload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · jcode_core · ×4
  • jcode_core::util::split_concatenated_json (cognitive 21) crates/jcode-core/src/util.rs:176 — jcode_core::util::split_concatenated_json has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, 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.
  • jcode_core::stdin_detect::linux::direct_children (cognitive 19) crates/jcode-core/src/stdin_detect.rs:150 — jcode_core::stdin_detect::linux::direct_children has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (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.
  • jcode_core::stdin_detect::linux::check_process_tree (cognitive 17) crates/jcode-core/src/stdin_detect.rs:83 — jcode_core::stdin_detect::linux::check_process_tree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_core::stdin_detect::linux::children_via_proc_scan (cognitive 17) crates/jcode-core/src/stdin_detect.rs:187 — jcode_core::stdin_detect::linux::children_via_proc_scan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (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.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×4
  • Duplicated block (37 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:127 — crates/jcode-app-core/src/telemetry_state.rs:127-163 | crates/jcode-telemetry-core/src/state_support.rs:125-161 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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 (37 lines × 2) crates/jcode-app-core/src/tool/apply_patch.rs:486 — crates/jcode-app-core/src/tool/apply_patch.rs:486-522 | crates/jcode-app-core/src/tool/patch.rs:458-494 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (37 lines × 2) crates/jcode-provider-anthropic-runtime/src/lib.rs:1327 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1327-1363 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1787-1823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (37 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:544 — crates/jcode-tui/src/tui/app/turn.rs:544-580 | crates/jcode-tui/src/tui/app/turn.rs:1546-1582 — both copies are in the same file, so extract the 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 lines × 3) · ×4
  • Duplicated block (15 lines × 3) crates/jcode-app-core/src/tool/gmail.rs:382 — crates/jcode-app-core/src/tool/gmail.rs:382-396 | crates/jcode-app-core/src/tool/gmail.rs:462-476 | crates/jcode-app-core/src/tool/gmail.rs:535-549 — 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 (15 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:796 — crates/jcode-provider-doctor/src/live_provider_probes.rs:796-810 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1124-1138 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1315-1329 — 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 (15 lines × 3) scripts/check_panic_budget.py:41 — scripts/check_panic_budget.py:41-55 | scripts/check_swallowed_error_budget.py:48-62 | scripts/check_test_size_budget.py:33-47 — before extracting anything, compare `scripts/check_panic_budget.py` and `scripts/check_swallowed_error_budget.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 3) crates/jcode-provider-doctor/src/provider_e2e.rs:451 — crates/jcode-provider-doctor/src/provider_e2e.rs:451-465 | crates/jcode-provider-doctor/src/provider_e2e.rs:744-758 | crates/jcode-provider-doctor/src/provider_e2e.rs:1735-1749 — 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–14 lines × 2) · ×4
  • Duplicated block (13–14 lines × 2) crates/jcode-app-core/src/tool/ambient.rs:436 — crates/jcode-app-core/src/tool/ambient.rs:436-449 | crates/jcode-tui-permissions/src/lib.rs:690-702 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13–14 lines × 2) crates/jcode-app-core/src/tool/session_search.rs:1380 — crates/jcode-app-core/src/tool/session_search.rs:1380-1392 | crates/jcode-app-core/src/tool/session_search.rs:1511-1524 — both copies are in the same file, so extract the block into 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–14 lines × 2) crates/jcode-base/src/embedding_stub.rs:191 — crates/jcode-base/src/embedding_stub.rs:191-203 | crates/jcode-embedding/src/lib.rs:388-401 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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–14 lines × 2) crates/jcode-tui/src/tui/session_picker.rs:483 — crates/jcode-tui/src/tui/session_picker.rs:483-496 | crates/jcode-tui/src/tui/session_picker.rs:704-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×4
  • Duplicated block (12–13 lines × 2) crates/jcode-tui/src/tui/app/runtime_memory.rs:129 — crates/jcode-tui/src/tui/app/runtime_memory.rs:129-141 | crates/jcode-tui/src/tui/app/runtime_memory.rs:166-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) crates/jcode-tui/src/tui/ui_header.rs:661 — crates/jcode-tui/src/tui/ui_header.rs:661-673 | crates/jcode-tui/src/tui/ui_header.rs:679-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) crates/jcode-tui/src/tui/ui_input.rs:942 — crates/jcode-tui/src/tui/ui_input.rs:942-953 | crates/jcode-tui/src/tui/ui_input.rs:1040-1052 — both copies are in the same file, so extract the block into 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) scripts/diagnose_idle_render_cost.py:377 — scripts/diagnose_idle_render_cost.py:377-389 | scripts/repro_slash_flicker.py:414-425 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_slash_flicker.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×4
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:576 — telemetry-worker/src/worker.js:576 · telemetry-worker/src/worker.js:611 — both copies are in the same file, so extract the block into 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 locations) telemetry-worker/src/worker.js:1310 — telemetry-worker/src/worker.js:1310 · telemetry-worker/src/worker.js:1326 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:1460 — telemetry-worker/src/worker.js:1460 · telemetry-worker/src/worker.js:1571 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:1497 — telemetry-worker/src/worker.js:1497 · telemetry-worker/src/worker.js:1758 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
D1 · Cyclomatic Complexity · jcode_provider_openai_runtime · ×3
  • jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked (cyclomatic 83) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:867 — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated (cyclomatic 42) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1740 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated 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.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response (cyclomatic 28) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:430 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response 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 · Server · ×3
  • Server::spawn_background_tasks (cyclomatic 44) crates/jcode-app-core/src/server.rs:1338 — Server::spawn_background_tasks has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Server::monitor_bus (cyclomatic 31) crates/jcode-app-core/src/server.rs:2078 — Server::monitor_bus 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.
  • Server::recover_headless_sessions_on_startup (cyclomatic 23) crates/jcode-app-core/src/server.rs:949 — Server::recover_headless_sessions_on_startup 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 · jcode_provider_anthropic_runtime · ×3
  • jcode_provider_anthropic_runtime::process_sse_event (cyclomatic 36) crates/jcode-provider-anthropic-runtime/src/lib.rs:2529 — jcode_provider_anthropic_runtime::process_sse_event 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.
  • jcode_provider_anthropic_runtime::run_stream_with_retries (cyclomatic 26) crates/jcode-provider-anthropic-runtime/src/lib.rs:1894 — jcode_provider_anthropic_runtime::run_stream_with_retries 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.
  • jcode_provider_anthropic_runtime::stream_response (cyclomatic 22) crates/jcode-provider-anthropic-runtime/src/lib.rs:2258 — jcode_provider_anthropic_runtime::stream_response 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 · AuthStatus · ×3
  • AuthStatus::method_detail_for_provider (cyclomatic 33) crates/jcode-base/src/auth/status_detail.rs:4 — AuthStatus::method_detail_for_provider 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.
  • AuthStatus::state_for_provider (cyclomatic 18) crates/jcode-base/src/auth/mod.rs:531 — AuthStatus::state_for_provider 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.
  • AuthStatus::assessment_for_provider (cyclomatic 18) crates/jcode-base/src/auth/mod.rs:603 — AuthStatus::assessment_for_provider 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 · jcode_todo_policy · ×3
  • jcode_todo_policy::completion_report::render_completion_report (cyclomatic 28) crates/jcode-todo-policy/src/completion_report.rs:146 — jcode_todo_policy::completion_report::render_completion_report 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.
  • jcode_todo_policy::auto_poke_display_summary (cyclomatic 18) crates/jcode-todo-policy/src/lib.rs:818 — jcode_todo_policy::auto_poke_display_summary 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.
  • jcode_todo_policy::build_gate_digest (cyclomatic 16) crates/jcode-todo-policy/src/lib.rs:405 — jcode_todo_policy::build_gate_digest 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 · jcode_voice · ×3
  • jcode_voice::streaming_capture::capture (cyclomatic 26) crates/jcode-voice/src/streaming_capture.rs:280 — jcode_voice::streaming_capture::capture 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.
  • jcode_voice::capture::run (cyclomatic 25) crates/jcode-voice/src/lib.rs:431 — jcode_voice::capture::run 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.
  • jcode_voice::command_capture::run_recorder (cyclomatic 22) crates/jcode-voice/src/command_capture.rs:247 — jcode_voice::command_capture::run_recorder 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 · jcode_schema_dialect · ×3
  • jcode_schema_dialect::dialect::walk (cyclomatic 25) crates/jcode-schema-dialect/src/dialect.rs:168 — jcode_schema_dialect::dialect::walk 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.
  • jcode_schema_dialect::conformance::walk (cyclomatic 21) crates/jcode-schema-dialect/src/conformance.rs:144 — jcode_schema_dialect::conformance::walk 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.
  • jcode_schema_dialect::dialect::flatten_top_level_combiners (cyclomatic 19) crates/jcode-schema-dialect/src/dialect.rs:291 — jcode_schema_dialect::dialect::flatten_top_level_combiners 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 · jcode_setup_hints · ×3
  • jcode_setup_hints::windows_setup::windows_native_hotkey_loop (cyclomatic 22) crates/jcode-setup-hints/src/windows_setup.rs:436 — jcode_setup_hints::windows_setup::windows_native_hotkey_loop 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.
  • jcode_setup_hints::keymap::chord::pretty_key (cyclomatic 19) crates/jcode-setup-hints/src/keymap/chord.rs:221 — jcode_setup_hints::keymap::chord::pretty_key has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: KeyChord::normalize_key (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.
  • jcode_setup_hints::windows_setup::run_setup_hotkey_windows (cyclomatic 16) crates/jcode-setup-hints/src/windows_setup.rs:968 — jcode_setup_hints::windows_setup::run_setup_hotkey_windows 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 · SelfDevTool · ×3
  • SelfDevTool::execute (cyclomatic 19) crates/jcode-app-core/src/tool/selfdev/mod.rs:589 — SelfDevTool::execute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SelfDevTool::do_setup (cyclomatic 17) crates/jcode-app-core/src/tool/selfdev/setup.rs:59 — SelfDevTool::do_setup 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.
  • SelfDevTool::do_build_reload (cyclomatic 16) crates/jcode-app-core/src/tool/selfdev/build_queue.rs:702 — SelfDevTool::do_build_reload 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 · jcode_import_core · ×3
  • jcode_import_core::ordered_claude_code_message_entries (cyclomatic 17) crates/jcode-import-core/src/lib.rs:288 — jcode_import_core::ordered_claude_code_message_entries 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.
  • jcode_import_core::extract_opencode_part_text (cyclomatic 17) crates/jcode-import-core/src/lib.rs:511 — jcode_import_core::extract_opencode_part_text 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.
  • jcode_import_core::load_codex_external_session (cyclomatic 16) crates/jcode-import-core/src/lib.rs:643 — jcode_import_core::load_codex_external_session 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 · Server · ×3
  • Server::spawn_background_tasks (cognitive 114) crates/jcode-app-core/src/server.rs:1338 — Server::spawn_background_tasks has cognitive complexity 114 (threshold 15). Drivers by points: if/else 34 (94 pts), loops 7 (11 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 68). 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.
  • Server::monitor_bus (cognitive 73) crates/jcode-app-core/src/server.rs:2078 — Server::monitor_bus has cognitive complexity 73 (threshold 15). Drivers by points: if/else 20 (61 pts), loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Server::recover_headless_sessions_on_startup (cognitive 42) crates/jcode-app-core/src/server.rs:949 — Server::recover_headless_sessions_on_startup has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 3 (6 pts), loops 2, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CopilotApiProvider · ×3
  • CopilotApiProvider::process_sse_stream (cognitive 110) crates/jcode-provider-copilot-runtime/src/lib.rs:739 — CopilotApiProvider::process_sse_stream has cognitive complexity 110 (threshold 15). Drivers by points: if/else 13 (73 pts), match/switch 4 (19 pts), loops 4 (15 pts), boolean chains 3 (nesting depth added 86). 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.
  • CopilotApiProvider::stream_request (cognitive 40) crates/jcode-provider-copilot-runtime/src/lib.rs:468 — CopilotApiProvider::stream_request has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (29 pts), match/switch 3 (6 pts), boolean chains 4, 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.
  • CopilotApiProvider::detect_tier_and_set_default (cognitive 16) crates/jcode-provider-copilot-runtime/src/lib.rs:320 — CopilotApiProvider::detect_tier_and_set_default has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_harness_api · ×3
  • jcode_harness_api::edit_stats::count_legacy_messages (cognitive 90) crates/jcode-harness-api/src/edit_stats.rs:128 — jcode_harness_api::edit_stats::count_legacy_messages has cognitive complexity 90 (threshold 15). Drivers by points: if/else 13 (63 pts), loops 4 (13 pts), match/switch 3 (12 pts), boolean chains 2 (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_harness_api::swarm_metadata::enrich_sessions_from_swarm_state (cognitive 25) crates/jcode-harness-api/src/swarm_metadata.rs:57 — jcode_harness_api::swarm_metadata::enrich_sessions_from_swarm_state has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_harness_api::edit_stats::enrich_sessions_from_edit_stats (cognitive 16) crates/jcode-harness-api/src/edit_stats.rs:283 — jcode_harness_api::edit_stats::enrich_sessions_from_edit_stats 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 · jcode_tui_anim · ×3
  • jcode_tui_anim::shape_char_3x3 (cognitive 73) crates/jcode-tui-anim/src/lib.rs:384 — jcode_tui_anim::shape_char_3x3 has cognitive complexity 73 (threshold 15). Drivers by points: if/else 27 (29 pts), match/switch 24 (27 pts), boolean chains 17 (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.
  • jcode_tui_anim::sample_gyroscope (cognitive 24) crates/jcode-tui-anim/src/lib.rs:186 — jcode_tui_anim::sample_gyroscope has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_tui_anim::sample_orbit_rings) 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.
  • jcode_tui_anim::sample_orbit_rings (cognitive 24) crates/jcode-tui-anim/src/lib.rs:276 — jcode_tui_anim::sample_orbit_rings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_tui_anim::sample_gyroscope) 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 · jcode_plan · ×3
  • jcode_plan::mermaid::swarm_plan_mermaid (cognitive 64) crates/jcode-plan/src/mermaid.rs:40 — jcode_plan::mermaid::swarm_plan_mermaid has cognitive complexity 64 (threshold 15). Drivers by points: if/else 25 (48 pts), loops 7 (12 pts), boolean chains 2, match/switch 1 (2 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.
  • jcode_plan::cycle_item_ids (cognitive 22) crates/jcode-plan/src/lib.rs:410 — jcode_plan::cycle_item_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 5 (8 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.
  • jcode_plan::assignment_affinities_for_task (cognitive 21) crates/jcode-plan/src/lib.rs:713 — jcode_plan::assignment_affinities_for_task 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 · jcode_provider_anthropic_runtime · ×3
  • jcode_provider_anthropic_runtime::process_sse_event (cognitive 62) crates/jcode-provider-anthropic-runtime/src/lib.rs:2529 — jcode_provider_anthropic_runtime::process_sse_event has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 39). 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.
  • jcode_provider_anthropic_runtime::run_stream_with_retries (cognitive 53) crates/jcode-provider-anthropic-runtime/src/lib.rs:1894 — jcode_provider_anthropic_runtime::run_stream_with_retries has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 10, match/switch 2 (6 pts), loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic_runtime::stream_response (cognitive 37) crates/jcode-provider-anthropic-runtime/src/lib.rs:2258 — jcode_provider_anthropic_runtime::stream_response has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 3 (6 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AuthStatus · ×3
  • AuthStatus::method_detail_for_provider (cognitive 60) crates/jcode-base/src/auth/status_detail.rs:4 — AuthStatus::method_detail_for_provider has cognitive complexity 60 (threshold 15). Drivers by points: if/else 32 (51 pts), match/switch 4 (9 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AuthStatus::state_for_provider (cognitive 22) crates/jcode-base/src/auth/mod.rs:531 — AuthStatus::state_for_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AuthStatus::assessment_for_provider (cognitive 22) crates/jcode-base/src/auth/mod.rs:603 — AuthStatus::assessment_for_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · jcode_todo_policy · ×3
  • jcode_todo_policy::completion_report::render_completion_report (cognitive 53) crates/jcode-todo-policy/src/completion_report.rs:146 — jcode_todo_policy::completion_report::render_completion_report has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 14 (22 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.
  • jcode_todo_policy::store::running_dependencies (cognitive 19) crates/jcode-todo-policy/src/store.rs:134 — jcode_todo_policy::store::running_dependencies has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 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.
  • jcode_todo_policy::auto_poke_display_summary (cognitive 17) crates/jcode-todo-policy/src/lib.rs:818 — jcode_todo_policy::auto_poke_display_summary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · jcode_fuzzy · ×3
  • jcode_fuzzy::run_dp (cognitive 49) crates/jcode-fuzzy/src/lib.rs:220 — jcode_fuzzy::run_dp has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 10, loops 5 (7 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_fuzzy::prefilter (cognitive 35) crates/jcode-fuzzy/src/lib.rs:140 — jcode_fuzzy::prefilter has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_fuzzy::fuzzy_match_impl (cognitive 17) crates/jcode-fuzzy/src/lib.rs:385 — jcode_fuzzy::fuzzy_match_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, 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 · jcode_provider_openrouter_runtime · ×3
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response (cognitive 35) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:192 — jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (27 pts), match/switch 2 (5 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.
  • jcode_provider_openrouter_runtime::opencode_go_responses::build_input (cognitive 26) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:94 — jcode_provider_openrouter_runtime::opencode_go_responses::build_input has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 3 (10 pts), if/else 3 (9 pts), loops 3 (7 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.
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::run_stream_with_retries (cognitive 18) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:59 — jcode_provider_openrouter_runtime::openrouter_sse_stream::run_stream_with_retries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeflateStream · ×3
  • DeflateStream::accept_write (cognitive 31) crates/jcode-provider-core/src/ws_deflate.rs:413 — DeflateStream::accept_write has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 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.
  • DeflateStream::process_read (cognitive 17) crates/jcode-provider-core/src/ws_deflate.rs:352 — DeflateStream::process_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, 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.
  • DeflateStream::poll_drain (cognitive 16) crates/jcode-provider-core/src/ws_deflate.rs:508 — DeflateStream::poll_drain 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 · jcode_productivity_core · ×3
  • jcode_productivity_core::scan::summarize (cognitive 28) crates/jcode-productivity-core/src/scan.rs:247 — jcode_productivity_core::scan::summarize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (5 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.
  • jcode_productivity_core::aggregate::build_report (cognitive 22) crates/jcode-productivity-core/src/aggregate.rs:20 — jcode_productivity_core::aggregate::build_report has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 5 (9 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.
  • jcode_productivity_core::scan::scan_all (cognitive 19) crates/jcode-productivity-core/src/scan.rs:59 — jcode_productivity_core::scan::scan_all has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 3 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryManager · ×3
  • MemoryManager::backfill_embeddings (cognitive 26) crates/jcode-base/src/memory.rs:811 — MemoryManager::backfill_embeddings has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryManager::load_project_graph (cognitive 25) crates/jcode-base/src/memory.rs:1226 — MemoryManager::load_project_graph has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 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.
  • MemoryManager::load_global_graph (cognitive 21) crates/jcode-base/src/memory.rs:1291 — MemoryManager::load_global_graph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveClient._pump (cognitive 26) · ×3
  • LiveClient._pump (cognitive 26) scripts/repro_expand_edit_shortcut.py:193 — LiveClient._pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (9 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LiveClient._pump (cognitive 26) scripts/repro_input_lag.py:169 — LiveClient._pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (9 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LiveClient._pump (cognitive 26) scripts/repro_live_duplicate.py:163 — LiveClient._pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (9 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_tui_workspace · ×3
  • jcode_tui_workspace::workspace_map_widget::tile_color (cognitive 25) crates/jcode-tui-workspace/src/workspace_map_widget.rs:141 — jcode_tui_workspace::workspace_map_widget::tile_color has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • jcode_tui_workspace::color_support::detect_raw_color_capability (cognitive 16) crates/jcode-tui-workspace/src/color_support.rs:63 — jcode_tui_workspace::color_support::detect_raw_color_capability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_workspace::workspace_map_widget::compute_workspace_tile_placements (cognitive 16) crates/jcode-tui-workspace/src/workspace_map_widget.rs:35 — jcode_tui_workspace::workspace_map_widget::compute_workspace_tile_placements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/jcode-tui/src/tui/ui_messages.rs:1069 — crates/jcode-tui/src/tui/ui_messages.rs:1069-1233 | crates/jcode-tui/src/tui/ui_messages.rs:2840-2928 | crates/jcode-tui/src/tui/ui_messages.rs:2984-3056 | crates/jcode-tui/src/tui/ui_messages.rs:3103-3188 | crates/jcode-tui/src/tui/ui_messages.rs:3194-3443 | crates/jcode-tui/src/tui/ui_messages.rs:3586-3640 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:94 — scripts/diagnose_idle_render_cost.py:94-110 | scripts/repro_expand_edit_shortcut.py:100-116 | scripts/repro_input_flicker.py:105-121 | scripts/repro_input_lag.py:107-123 | scripts/repro_live_duplicate.py:68-85 | scripts/repro_slash_flicker.py:101-117 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:151 — scripts/diagnose_idle_render_cost.py:151-178 | scripts/repro_expand_edit_shortcut.py:194-222 | scripts/repro_input_flicker.py:212-245 | scripts/repro_input_lag.py:170-201 | scripts/repro_live_duplicate.py:164-192 | scripts/repro_slash_flicker.py:172-204 — 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 (33 lines × 2) · ×3
  • Duplicated block (33 lines × 2) crates/jcode-base/src/provider/openrouter.rs:252 — crates/jcode-base/src/provider/openrouter.rs:252-284 | crates/jcode-provider-openrouter-runtime/src/lib.rs:337-369 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 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 (33 lines × 2) crates/jcode-telemetry-core/src/lib.rs:386 — crates/jcode-telemetry-core/src/lib.rs:386-418 | crates/jcode-telemetry-core/src/lib.rs:2023-2055 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) crates/jcode-tui/src/tui/app/remote/reconnect.rs:118 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:118-150 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:164-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×3
  • Duplicated block (32 lines × 2) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:630 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:630-661 | crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:1252-1283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (32 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2721 — crates/jcode-app-core/src/server/client_lifecycle.rs:2721-2752 | crates/jcode-app-core/src/server/client_lightweight_control.rs:615-646 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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. 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 (32 lines × 2) crates/jcode-render-core/src/preprocess.rs:861 — crates/jcode-render-core/src/preprocess.rs:861-892 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:67-98 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) crates/jcode-app-core/src/agent/status.rs:165 — crates/jcode-app-core/src/agent/status.rs:165-194 | crates/jcode-app-core/src/agent/turn_execution.rs:1494-1523 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 (30 lines × 2) crates/jcode-render-core/src/preprocess.rs:786 — crates/jcode-render-core/src/preprocess.rs:786-815 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:16-45 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) crates/jcode-tui/src/tui/app/debug.rs:32 — crates/jcode-tui/src/tui/app/debug.rs:32-61 | src/bin/tui_bench.rs:162-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 (28 lines × 2) · ×3
  • Duplicated block (28 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:53 — crates/jcode-app-core/src/server/client_actions.rs:53-80 | crates/jcode-tui/src/tui/app/input/shell_commands.rs:20-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (28 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:935 — crates/jcode-provider-doctor/src/live_provider_probes.rs:935-962 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1566-1593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (28 lines × 2) scripts/benchmark_swarm.py:292 — scripts/benchmark_swarm.py:292-319 | scripts/benchmark_swarm.py:420-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:3111 — crates/jcode-app-core/src/server/client_lifecycle.rs:3111-3137 | crates/jcode-app-core/src/server/client_lightweight_control.rs:984-1010 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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. 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/jcode-base/src/background.rs:460 — crates/jcode-base/src/background.rs:460-486 | crates/jcode-base/src/background.rs:677-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:931 — crates/jcode-app-core/src/server/client_actions.rs:931-957 | crates/jcode-app-core/src/server/client_actions.rs:1041-1067 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×3
  • Duplicated block (26 lines × 2) crates/jcode-render-core/src/preprocess.rs:895 — crates/jcode-render-core/src/preprocess.rs:895-920 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:101-126 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (26 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2602 — crates/jcode-tui/src/tui/session_picker/loading.rs:2602-2627 | crates/jcode-tui/src/tui/session_picker/loading.rs:2688-2713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) scripts/check_panic_budget.py:80 — scripts/check_panic_budget.py:80-105 | scripts/check_swallowed_error_budget.py:81-106 — before extracting anything, compare `scripts/check_panic_budget.py` and `scripts/check_swallowed_error_budget.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2873 — crates/jcode-app-core/src/server/client_lifecycle.rs:2873-2897 | crates/jcode-app-core/src/server/client_lightweight_control.rs:755-779 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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. 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 (25 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:40 — crates/jcode-app-core/src/telemetry_state.rs:40-64 | crates/jcode-telemetry-core/src/state_support.rs:46-70 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 153 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 (25 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:1253 — crates/jcode-provider-doctor/src/provider_e2e.rs:1253-1277 | crates/jcode-provider-doctor/src/provider_e2e.rs:1905-1929 — both copies are in the same file, so extract the 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 lines × 2) · ×3
  • Duplicated block (24 lines × 2) crates/jcode-app-core/src/server/client_state.rs:1154 — crates/jcode-app-core/src/server/client_state.rs:1154-1177 | crates/jcode-app-core/src/server/comm_sync.rs:31-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (24 lines × 2) crates/jcode-app-core/src/tool/computer/input.rs:161 — crates/jcode-app-core/src/tool/computer/input.rs:161-184 | crates/jcode-app-core/src/tool/computer/input.rs:210-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:910 — crates/jcode-provider-doctor/src/provider_e2e.rs:910-933 | crates/jcode-provider-doctor/src/provider_e2e.rs:2221-2244 — both copies are in the same file, so extract the 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–23 lines × 2) · ×3
  • Duplicated block (22–23 lines × 2) crates/jcode-base/src/prompt.rs:409 — crates/jcode-base/src/prompt.rs:409-431 | crates/jcode-base/src/prompt.rs:548-569 — both copies are in the same file, so extract the block into 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/jcode-base/src/session.rs:785 — crates/jcode-base/src/session.rs:785-806 | crates/jcode-base/src/session.rs:842-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 (22–23 lines × 2) scripts/phone-server/testflight-setup.py:83 — scripts/phone-server/testflight-setup.py:83-104 | scripts/phone-server/testflight-setup.py:108-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. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/phone-server/testflight-setup.py:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×3
  • Duplicated block (18–19 lines × 2) crates/jcode-render-core/src/preprocess.rs:65 — crates/jcode-render-core/src/preprocess.rs:65-82 | crates/jcode-render-core/src/preprocess.rs:137-155 — both copies are in the same file, so extract the block into 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–19 lines × 2) crates/jcode-tui/src/tui/app.rs:1961 — crates/jcode-tui/src/tui/app.rs:1961-1979 | crates/jcode-tui/src/tui/app.rs:2020-2037 — both copies are in the same file, so extract the block into 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–19 lines × 2) crates/jcode-tui/src/tui/ui.rs:2834 — crates/jcode-tui/src/tui/ui.rs:2834-2852 | crates/jcode-tui/src/tui/ui.rs:2912-2929 — both copies are in the same file, so extract the 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/jcode-tui/src/tui/keybind.rs:650 — crates/jcode-tui/src/tui/keybind.rs:650-660 | crates/jcode-tui/src/tui/keybind.rs:667-677 | crates/jcode-tui/src/tui/keybind.rs:684-694 | crates/jcode-tui/src/tui/keybind.rs:701-711 — 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) src/cli/acp.rs:476 — src/cli/acp.rs:476-486 | src/cli/acp.rs:529-539 | src/cli/acp.rs:621-631 | src/cli/acp.rs:641-651 — 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) scripts/diagnose_idle_render_cost.py:114 — scripts/diagnose_idle_render_cost.py:114-124 | scripts/repro_input_flicker.py:125-135 | scripts/repro_input_lag.py:127-137 | scripts/repro_slash_flicker.py:121-131 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×3
  • Duplicated block (10 lines × 4) crates/jcode-app-core/src/tool/session_search.rs:867 — crates/jcode-app-core/src/tool/session_search.rs:867-876 | crates/jcode-app-core/src/tool/session_search.rs:939-948 | crates/jcode-app-core/src/tool/session_search.rs:1146-1155 | crates/jcode-app-core/src/tool/session_search.rs:1252-1261 — 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 (10 lines × 4) crates/jcode-provider-cursor-runtime/src/wire.rs:751 — crates/jcode-provider-cursor-runtime/src/wire.rs:751-760 | crates/jcode-provider-cursor-runtime/src/wire.rs:793-802 | crates/jcode-provider-cursor-runtime/src/wire.rs:805-814 | crates/jcode-provider-cursor-runtime/src/wire.rs:817-826 — 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 (10 lines × 4) src/bin/memory_recall_bench.rs:1231 — src/bin/memory_recall_bench.rs:1231-1240 | src/bin/memory_recall_bench.rs:1469-1478 | src/bin/memory_recall_bench.rs:1601-1610 | src/bin/memory_recall_bench.rs:1867-1876 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×3
  • Duplicated block (7–8 lines × 3) crates/jcode-app-core/src/agent/status.rs:171 — crates/jcode-app-core/src/agent/status.rs:171-178 | crates/jcode-app-core/src/agent/turn_execution.rs:1500-1507 | crates/jcode-base/src/memory_agent.rs:55-61 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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–8 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:210 — crates/jcode-tui/src/tui/app/turn.rs:210-216 | crates/jcode-tui/src/tui/app/turn.rs:405-412 | crates/jcode-tui/src/tui/app/turn.rs:1511-1517 — 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–8 lines × 3) scripts/diagnose_idle_render_cost.py:376 — scripts/diagnose_idle_render_cost.py:376-382 | scripts/repro_input_lag.py:539-546 | scripts/repro_slash_flicker.py:413-419 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_lag.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×3
  • Duplicated block (7 lines × 6) crates/jcode-provider-cursor-runtime/src/wire.rs:715 — crates/jcode-provider-cursor-runtime/src/wire.rs:715-721 | crates/jcode-provider-cursor-runtime/src/wire.rs:856-862 | crates/jcode-provider-cursor-runtime/src/wire.rs:878-884 | crates/jcode-provider-cursor-runtime/src/wire.rs:897-903 | crates/jcode-provider-cursor-runtime/src/wire.rs:923-929 | crates/jcode-provider-cursor-runtime/src/wire.rs:941-947 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 6) crates/jcode-tui-account-picker/src/overlay.rs:508 — crates/jcode-tui-account-picker/src/overlay.rs:508-514 | crates/jcode-tui-account-picker/src/overlay.rs:584-590 | crates/jcode-tui-usage-overlay/src/lib.rs:513-519 | crates/jcode-tui-usage-overlay/src/lib.rs:598-604 | crates/jcode-tui/src/tui/login_picker.rs:414-420 | crates/jcode-tui/src/tui/login_picker.rs:477-483 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 6) crates/jcode-tui/src/tui/ui_messages.rs:1110 — crates/jcode-tui/src/tui/ui_messages.rs:1110-1116 | crates/jcode-tui/src/tui/ui_messages.rs:2843-2849 | crates/jcode-tui/src/tui/ui_messages.rs:2987-2993 | crates/jcode-tui/src/tui/ui_messages.rs:3106-3112 | crates/jcode-tui/src/tui/ui_messages.rs:3378-3384 | crates/jcode-tui/src/tui/ui_messages.rs:3595-3601 — 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 (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) crates/jcode-base/src/auth/azure.rs:15 — crates/jcode-base/src/auth/azure.rs:15-21 | crates/jcode-base/src/provider/openrouter.rs:191-197 | crates/jcode-provider-openrouter-runtime/src/lib.rs:220-226 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:205-211 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 126 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 × 4) crates/jcode-tui/src/tui/app/dictation.rs:168 — crates/jcode-tui/src/tui/app/dictation.rs:168-174 | crates/jcode-tui/src/tui/app/input.rs:1963-1969 | crates/jcode-tui/src/tui/app/input.rs:1972-1978 | crates/jcode-tui/src/tui/app/input.rs:1985-1991 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 4) crates/jcode-tui/src/tui/ui_overlays.rs:347 — crates/jcode-tui/src/tui/ui_overlays.rs:347-353 | crates/jcode-tui/src/tui/ui_overlays.rs:437-443 | crates/jcode-tui/src/tui/ui_overlays.rs:478-484 | crates/jcode-tui/src/tui/ui_overlays.rs:619-625 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×3
  • Low cohesion: MemoryManager (LCOM4 6) crates/jcode-base/src/memory.rs:184 — MemoryManager'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: MemoryEntry (LCOM4 6) crates/jcode-memory-types/src/lib.rs:233 — MemoryEntry'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: App (LCOM4 6) crates/jcode-tui/src/tui/app.rs:965 — App'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.
R4 · Test Coverage · No test reaches this file · ×3
  • No test reaches this file telemetry-worker/scripts/sync-model-prices.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 telemetry-worker/scripts/move-bulk-events.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 telemetry-worker/scripts/run-dashboard.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.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×3
  • Recursive walk over a caller-supplied document has no depth cap scripts/analyze_runtime_memory_log.py:1083 — `print_human` is public and takes `summary: dict[str, Any]` from its caller, and it calls itself at line 1083 (`print_human`) with a piece of `summary` — and nowhere in `print_human` 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 `print_human` 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/analyze_runtime_memory_log.py:1245 — `to_jsonable` is public and takes `value: Any` from its caller, and it calls itself at line 1245 (`to_jsonable`) with a piece of `value` (and at line 1247) — and nowhere in `to_jsonable` 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 `to_jsonable` 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/audit_terminal_bench_submission.py:36 — `iter_json_values` is public and takes `value: Any` from its caller, and it calls itself at line 36 (`iter_json_values`) with a piece of `value` (and at line 39) — and nowhere in `iter_json_values` 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 `iter_json_values` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D1 · Cyclomatic Complexity · BridgeState · ×2
  • BridgeState::legacy_event_to_api (cyclomatic 137) crates/jcode-harness-api-server/src/translate.rs:1541 — BridgeState::legacy_event_to_api has cyclomatic complexity 137 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BridgeState::translate_request (cyclomatic 128) crates/jcode-harness-api-server/src/translate.rs:382 — BridgeState::translate_request has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenRouterProvider · ×2
  • OpenRouterProvider::complete (cyclomatic 41) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:38 — OpenRouterProvider::complete 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.
  • OpenRouterProvider::available_models_display (cyclomatic 17) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:547 — OpenRouterProvider::available_models_display 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 · jcode_protocol · ×2
  • jcode_protocol::comm_format::format_comm_members (cyclomatic 29) crates/jcode-protocol/src/comm_format.rs:134 — jcode_protocol::comm_format::format_comm_members 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.
  • jcode_protocol::comm_format::format_comm_status_snapshot (cyclomatic 16) crates/jcode-protocol/src/comm_format.rs:364 — jcode_protocol::comm_format::format_comm_status_snapshot 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 · CopilotApiProvider · ×2
  • CopilotApiProvider::process_sse_stream (cyclomatic 29) crates/jcode-provider-copilot-runtime/src/lib.rs:739 — CopilotApiProvider::process_sse_stream 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.
  • CopilotApiProvider::stream_request (cyclomatic 20) crates/jcode-provider-copilot-runtime/src/lib.rs:468 — CopilotApiProvider::stream_request 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 · Registry · ×2
  • Registry::execute (cyclomatic 28) crates/jcode-app-core/src/tool/mod.rs:992 — Registry::execute has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Registry::register_mcp_tools_for_dir (cyclomatic 20) crates/jcode-app-core/src/tool/mod.rs:1573 — Registry::register_mcp_tools_for_dir 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 · jcode_fuzzy · ×2
  • jcode_fuzzy::run_dp (cyclomatic 28) crates/jcode-fuzzy/src/lib.rs:220 — jcode_fuzzy::run_dp 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.
  • jcode_fuzzy::prefilter (cyclomatic 17) crates/jcode-fuzzy/src/lib.rs:140 — jcode_fuzzy::prefilter 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 · jcode_tui_core · ×2
  • jcode_tui_core::keybind::parse_keybinding (cyclomatic 28) crates/jcode-tui-core/src/keybind.rs:224 — jcode_tui_core::keybind::parse_keybinding 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.
  • jcode_tui_core::keybind::format_binding (cyclomatic 26) crates/jcode-tui-core/src/keybind.rs:533 — jcode_tui_core::keybind::format_binding 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. This is NOT this file's highest cyclomatic complexity: jcode_tui_core::keybind::macos_option_char_to_ascii_key (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 · AcpRuntime · ×2
  • AcpRuntime::run_prompt (cyclomatic 24) src/cli/acp.rs:985 — AcpRuntime::run_prompt 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.
  • AcpRuntime::handle_message (cyclomatic 17) src/cli/acp.rs:358 — AcpRuntime::handle_message 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 · jcode_terminal_launch · ×2
  • jcode_terminal_launch::detected_resume_terminal_with_client_env (cyclomatic 23) crates/jcode-terminal-launch/src/lib.rs:218 — jcode_terminal_launch::detected_resume_terminal_with_client_env 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.
  • jcode_terminal_launch::build_spawn_command (cyclomatic 22) crates/jcode-terminal-launch/src/lib.rs:649 — jcode_terminal_launch::build_spawn_command has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Session · ×2
  • Session::redacted_for_export (cyclomatic 22) crates/jcode-base/src/session.rs:1219 — Session::redacted_for_export 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.
  • Session::save_inner (cyclomatic 16) crates/jcode-base/src/session/persistence.rs:614 — Session::save_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 · jcode_sdk · ×2
  • jcode_sdk::launch::launch_instance (cyclomatic 22) crates/jcode-sdk/src/launch.rs:175 — jcode_sdk::launch::launch_instance 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.
  • jcode_sdk::launch::inherit_credentials (cyclomatic 18) crates/jcode-sdk/src/launch.rs:373 — jcode_sdk::launch::inherit_credentials 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 · BashTool · ×2
  • BashTool::execute_foreground (cyclomatic 20) REDACTED:1010 — BashTool::execute_foreground 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.
  • BashTool::execute_background (cyclomatic 20) REDACTED:1393 — BashTool::execute_background 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 · BackgroundTaskManager · ×2
  • BackgroundTaskManager::wait (cyclomatic 20) crates/jcode-base/src/background.rs:900 — BackgroundTaskManager::wait 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.
  • BackgroundTaskManager::cleanup_filtered (cyclomatic 19) crates/jcode-base/src/background.rs:1522 — BackgroundTaskManager::cleanup_filtered 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 · jcode_productivity_core · ×2
  • jcode_productivity_core::aggregate::build_report (cyclomatic 17) crates/jcode-productivity-core/src/aggregate.rs:20 — jcode_productivity_core::aggregate::build_report 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.
  • jcode_productivity_core::scan::summarize (cyclomatic 17) crates/jcode-productivity-core/src/scan.rs:247 — jcode_productivity_core::scan::summarize has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · OpenRouterStream · ×2
  • OpenRouterStream::parse_next_event (cognitive 126) crates/jcode-provider-openrouter/src/stream.rs:273 — OpenRouterStream::parse_next_event has cognitive complexity 126 (threshold 15). Drivers by points: if/else 28 (90 pts), loops 6 (18 pts), match/switch 3 (11 pts), boolean chains 7 (nesting depth added 82). 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.
  • OpenRouterStream::poll_next (cognitive 22) crates/jcode-provider-openrouter/src/stream.rs:541 — OpenRouterStream::poll_next has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 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 · jcode_tui_tool_display · ×2
  • jcode_tui_tool_display::parse_tool_failure (cognitive 56) crates/jcode-tui-tool-display/src/lib.rs:208 — jcode_tui_tool_display::parse_tool_failure has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 20, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_tool_display::without_ansi (cognitive 21) crates/jcode-tui-tool-display/src/lib.rs:176 — jcode_tui_tool_display::without_ansi has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 2, 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 · BashTool · ×2
  • BashTool::execute_foreground (cognitive 52) REDACTED:1010 — BashTool::execute_foreground has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (41 pts), match/switch 3 (8 pts), loops 1 (3 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • BashTool::execute_background (cognitive 30) REDACTED:1393 — BashTool::execute_background has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 10 (12 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ResponsesStream · ×2
  • ResponsesStream::parse_event (cognitive 51) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:208 — ResponsesStream::parse_event has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 5, match/switch 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.
  • ResponsesStream::poll_next (cognitive 26) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:464 — ResponsesStream::poll_next has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry · ×2
  • Registry::register_mcp_tools_for_dir (cognitive 48) crates/jcode-app-core/src/tool/mod.rs:1573 — Registry::register_mcp_tools_for_dir has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Registry::execute (cognitive 40) crates/jcode-app-core/src/tool/mod.rs:992 — Registry::execute has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 8, loops 2 (4 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 · GeminiProvider · ×2
  • GeminiProvider::complete (cognitive 47) crates/jcode-provider-gemini-runtime/src/lib.rs:714 — GeminiProvider::complete has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 5 (9 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • GeminiProvider::setup_runtime_state (cognitive 16) crates/jcode-provider-gemini-runtime/src/lib.rs:198 — GeminiProvider::setup_runtime_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · jcode_compaction_core · ×2
  • jcode_compaction_core::build_compaction_conversation_text (cognitive 37) crates/jcode-compaction-core/src/lib.rs:162 — jcode_compaction_core::build_compaction_conversation_text has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_compaction_core::decay_old_tool_images_in_contents (cognitive 17) crates/jcode-compaction-core/src/lib.rs:845 — jcode_compaction_core::decay_old_tool_images_in_contents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryGraph · ×2
  • MemoryGraph::cascade_retrieve (cognitive 37) crates/jcode-memory-types/src/graph.rs:546 — MemoryGraph::cascade_retrieve has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryGraph::remove_memory (cognitive 16) crates/jcode-memory-types/src/graph.rs:324 — MemoryGraph::remove_memory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PermissionsApp · ×2
  • PermissionsApp::run (cognitive 37) crates/jcode-tui-permissions/src/lib.rs:509 — PermissionsApp::run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 2 (7 pts), boolean chains 3, 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.
  • PermissionsApp::render_list (cognitive 17) crates/jcode-tui-permissions/src/lib.rs:149 — PermissionsApp::render_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session · ×2
  • Session::redacted_for_export (cognitive 32) crates/jcode-base/src/session.rs:1219 — Session::redacted_for_export has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 6 (13 pts), match/switch 2 (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.
  • Session::save_inner (cognitive 23) crates/jcode-base/src/session/persistence.rs:614 — Session::save_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, 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 · jcode_tui_core · ×2
  • jcode_tui_core::graph_topology::collect_edges (cognitive 29) crates/jcode-tui-core/src/graph_topology.rs:180 — jcode_tui_core::graph_topology::collect_edges has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 3 (6 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.
  • jcode_tui_core::anchor_stability::align_frames (cognitive 23) crates/jcode-tui-core/src/anchor_stability.rs:408 — jcode_tui_core::anchor_stability::align_frames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 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 · jcode_companion · ×2
  • jcode_companion::voice::run (cognitive 28) crates/jcode-companion/src/voice.rs:67 — jcode_companion::voice::run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_companion::voice::wait_final (cognitive 17) crates/jcode-companion/src/voice.rs:189 — jcode_companion::voice::wait_final has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 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 · tls_bad_record_mac_repro · ×2
  • tls_bad_record_mac_repro::corrupt_proxy (cognitive 25) scripts/repro/tls-bad-record-mac/src/main.rs:264 — tls_bad_record_mac_repro::corrupt_proxy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (5 pts), match/switch 2 (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.
  • tls_bad_record_mac_repro::main (cognitive 18) scripts/repro/tls-bad-record-mac/src/main.rs:116 — tls_bad_record_mac_repro::main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, match/switch 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_terminal_launch · ×2
  • jcode_terminal_launch::parse_hook_command (cognitive 20) crates/jcode-terminal-launch/src/lib.rs:486 — jcode_terminal_launch::parse_hook_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_terminal_launch::detected_resume_terminal_with_client_env (cognitive 18) crates/jcode-terminal-launch/src/lib.rs:218 — jcode_terminal_launch::detected_resume_terminal_with_client_env has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 6, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AccountPicker · ×2
  • AccountPicker::provider_overview_line (cognitive 20) crates/jcode-tui-account-picker/src/overlay.rs:250 — AccountPicker::provider_overview_line has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 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.
  • AccountPicker::render_detail_pane (cognitive 19) crates/jcode-tui-account-picker/src/overlay.rs:579 — AccountPicker::render_detail_pane has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InfoWidgetData · ×2
  • InfoWidgetData::effective_priority (cognitive 18) crates/jcode-tui/src/tui/info_widget.rs:873 — InfoWidgetData::effective_priority has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, 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.
  • InfoWidgetData::has_data_for (cognitive 17) crates/jcode-tui/src/tui/info_widget.rs:768 — InfoWidgetData::has_data_for has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, 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.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×2
  • Near-duplicate member pair (38 shared lines) crates/jcode-provider-openrouter-runtime/src/lib.rs:2632 — crates/jcode-provider-openrouter-runtime/src/lib.rs:2632-2701 | crates/jcode-provider-openrouter-runtime/src/lib.rs:2704-2750 — 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/jcode-tui/src/tui/app/commands_improve.rs:456 — crates/jcode-tui/src/tui/app/commands_improve.rs:456-523 | crates/jcode-tui/src/tui/app/commands_improve.rs:525-592 — 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 · Edited copy of a member (17 corresponding lines) · ×2
  • Edited copy of a member (17 corresponding lines) crates/jcode-tui/src/tui/ui.rs:994 — crates/jcode-tui/src/tui/ui.rs:994-1010 | crates/jcode-tui/src/tui/ui.rs:1271-1287 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/jcode-tui-style/src/color.rs:222 — crates/jcode-tui-style/src/color.rs:222-238 | crates/jcode-tui-workspace/src/color_support.rs:184-200 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×2
  • Duplicated block (45 lines × 2) crates/jcode-import-core/src/lib.rs:404 — crates/jcode-import-core/src/lib.rs:404-448 | crates/jcode-tui/src/tui/session_picker/loading.rs:737-781 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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 (45 lines × 2) scripts/jcode_harbor_agent.py:254 — scripts/jcode_harbor_agent.py:254-298 | scripts/jcode_harbor_claude_agent.py:283-327 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 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) · ×2
  • Duplicated block (34 lines × 2) crates/jcode-app-core/src/usage_openai.rs:139 — crates/jcode-app-core/src/usage_openai.rs:139-172 | crates/jcode-base/src/usage/openai_helpers.rs:153-186 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (34 lines × 2) scripts/jcode_harbor_agent.py:150 — scripts/jcode_harbor_agent.py:150-183 | scripts/jcode_harbor_claude_agent.py:151-184 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×2
  • Duplicated block (29–30 lines × 2) crates/jcode-app-core/src/tool/mcp.rs:442 — crates/jcode-app-core/src/tool/mcp.rs:442-470 | crates/jcode-base/src/mcp/tool.rs:85-114 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (29–30 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:2976 — crates/jcode-tui/src/tui/app/inline_interactive.rs:2976-3004 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3084-3113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1753 — crates/jcode-app-core/src/server/client_lifecycle.rs:1753-1781 | crates/jcode-app-core/src/server/client_lifecycle.rs:1783-1811 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (29 lines × 2) crates/jcode-app-core/src/usage_display.rs:33 — crates/jcode-app-core/src/usage_display.rs:33-61 | crates/jcode-base/src/usage/display.rs:33-61 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 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 (28 lines × 3) · ×2
  • Duplicated block (28 lines × 3) crates/jcode-app-core/src/usage_display.rs:140 — crates/jcode-app-core/src/usage_display.rs:140-167 | crates/jcode-base/src/usage/display.rs:144-171 | crates/jcode-tui-usage-overlay/src/lib.rs:744-771 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 136 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 (28 lines × 3) src/cli/commands.rs:3278 — src/cli/commands.rs:3278-3305 | src/cli/commands.rs:3395-3422 | src/cli/commands.rs:3592-3619 — 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 (23–25 lines × 2) · ×2
  • Duplicated block (23–25 lines × 2) crates/jcode-app-core/src/server/comm_session.rs:181 — crates/jcode-app-core/src/server/comm_session.rs:181-205 | crates/jcode-app-core/src/server/jade_relay.rs:1087-1109 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (23–25 lines × 2) crates/jcode-provider-openrouter-runtime/src/lib.rs:2668 — crates/jcode-provider-openrouter-runtime/src/lib.rs:2668-2692 | crates/jcode-provider-openrouter-runtime/src/lib.rs:2722-2744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×2
  • Duplicated block (23–24 lines × 2) crates/jcode-base/src/provider/mod.rs:541 — crates/jcode-base/src/provider/mod.rs:541-563 | crates/jcode-base/src/provider/mod.rs:682-705 — both copies are in the same file, so extract the block into 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–24 lines × 2) crates/jcode-provider-antigravity-runtime/src/lib.rs:364 — crates/jcode-provider-antigravity-runtime/src/lib.rs:364-386 | crates/jcode-provider-gemini-runtime/src/lib.rs:636-659 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×2
  • Duplicated block (19–21 lines × 2) crates/jcode-tui/src/tui/app.rs:1981 — crates/jcode-tui/src/tui/app.rs:1981-2001 | crates/jcode-tui/src/tui/app.rs:2038-2056 — both copies are in the same file, so extract the block into 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–21 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:2035 — crates/jcode-tui/src/tui/app/commands.rs:2035-2053 | crates/jcode-tui/src/tui/app/commands.rs:2114-2134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×2
  • Duplicated block (20 lines × 3) crates/jcode-import-core/src/lib.rs:1045 — crates/jcode-import-core/src/lib.rs:1045-1064 | crates/jcode-tui/src/tui/session_picker/loading.rs:2860-2879 | crates/jcode-tui/src/tui/session_picker/loading.rs:2911-2930 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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 lines × 3) crates/jcode-provider-doctor/src/provider_e2e.rs:530 — crates/jcode-provider-doctor/src/provider_e2e.rs:530-551 | crates/jcode-provider-doctor/src/provider_e2e.rs:826-845 | crates/jcode-provider-doctor/src/provider_e2e.rs:1186-1205 — 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 (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:338 — crates/jcode-tui-account-picker/src/overlay.rs:338-355 | crates/jcode-tui-usage-overlay/src/lib.rs:356-373 | crates/jcode-tui/src/tui/login_picker.rs:227-244 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (18 lines × 3) crates/jcode-tui-account-picker/src/overlay_render.rs:278 — crates/jcode-tui-account-picker/src/overlay_render.rs:278-295 | crates/jcode-tui-usage-overlay/src/lib.rs:865-882 | crates/jcode-tui/src/tui/login_picker.rs:863-880 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.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 (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) crates/jcode-base/src/sidecar.rs:917 — crates/jcode-base/src/sidecar.rs:917-933 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2274-2291 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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–18 lines × 2) crates/jcode-tui/src/tui/cloud_git.rs:142 — crates/jcode-tui/src/tui/cloud_git.rs:142-158 | REDACTED:333-350 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×2
  • Duplicated block (14–17 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1550 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1550-1566 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1575-1588 — both copies are in the same file, so extract the block into 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–17 lines × 2) crates/jcode-tui/src/tui/ui_prepare.rs:639 — crates/jcode-tui/src/tui/ui_prepare.rs:639-652 | crates/jcode-tui/src/tui/ui_prepare.rs:1090-1106 — both copies are in the same file, so extract the 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–17 lines × 2) · ×2
  • Duplicated block (15–17 lines × 2) src/cli/acp.rs:548 — src/cli/acp.rs:548-564 | src/cli/acp.rs:670-684 — both copies are in the same file, so extract the block into 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–17 lines × 2) src/cli/acp.rs:1388 — src/cli/acp.rs:1388-1402 | src/cli/acp.rs:1410-1426 — both copies are in the same file, so extract the 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 × 3) · ×2
  • Duplicated block (16 lines × 3) crates/jcode-base/src/provider/dispatch.rs:233 — crates/jcode-base/src/provider/dispatch.rs:233-248 | crates/jcode-base/src/provider/dispatch.rs:275-290 | crates/jcode-base/src/provider/dispatch.rs:298-313 — 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 (16 lines × 3) crates/jcode-tui/src/tui/ui_file_diff.rs:26 — crates/jcode-tui/src/tui/ui_file_diff.rs:26-41 | crates/jcode-tui/src/tui/ui_overlays.rs:118-133 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:26-41 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15–16 lines × 3) · ×2
  • Duplicated block (15–16 lines × 3) crates/jcode-tui/src/tui/app/inline_interactive.rs:1260 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1260-1275 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1576-1590 | crates/jcode-tui/src/tui/app/inline_interactive.rs:2307-2321 — 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 (15–16 lines × 3) crates/jcode-tui/src/tui/ui_inline_interactive.rs:906 — crates/jcode-tui/src/tui/ui_inline_interactive.rs:906-920 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:985-999 | crates/jcode-tui/src/tui/ui_input/command_suggestions.rs:98-113 — 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.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×2
  • Duplicated block (13–16 lines × 2) crates/jcode-base/src/auth/oauth.rs:272 — crates/jcode-base/src/auth/oauth.rs:272-284 | crates/jcode-base/src/auth/oauth.rs:388-403 — both copies are in the same file, so extract the block into 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–16 lines × 2) crates/jcode-tui-core/src/keybind.rs:66 — crates/jcode-tui-core/src/keybind.rs:66-78 | crates/jcode-tui/src/tui/keybind.rs:589-604 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×2
  • Duplicated block (14–15 lines × 3) crates/jcode-tui/src/tui/session_picker.rs:405 — crates/jcode-tui/src/tui/session_picker.rs:405-418 | crates/jcode-tui/src/tui/session_picker.rs:454-468 | crates/jcode-tui/src/tui/session_picker.rs:535-548 — 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–15 lines × 3) scripts/profile_remote_resume_burst.py:322 — scripts/profile_remote_resume_burst.py:322-335 | scripts/repro_expand_edit_shortcut.py:443-457 | scripts/repro_live_duplicate.py:454-468 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (13–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) crates/jcode-base/src/auth/oauth.rs:258 — crates/jcode-base/src/auth/oauth.rs:258-270 | crates/jcode-base/src/auth/oauth.rs:372-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–15 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:250 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:250-264 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:489-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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) crates/jcode-app-core/src/server/provider_control.rs:478 — crates/jcode-app-core/src/server/provider_control.rs:478-491 | crates/jcode-app-core/src/server/provider_control.rs:586-599 | crates/jcode-app-core/src/server/provider_control.rs:708-721 — 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/jcode-tui-account-picker/src/overlay_render.rs:263 — crates/jcode-tui-account-picker/src/overlay_render.rs:263-276 | crates/jcode-tui-usage-overlay/src/lib.rs:850-863 | crates/jcode-tui/src/tui/login_picker.rs:848-861 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.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 (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) crates/jcode-base/src/auth/oauth.rs:246 — crates/jcode-base/src/auth/oauth.rs:246-256 | crates/jcode-base/src/auth/oauth.rs:358-370 — both copies are in the same file, so extract the block into 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/jcode-base/src/memory.rs:796 — crates/jcode-base/src/memory.rs:796-808 | src/bin/memory_recall_bench.rs:197-207 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (9–12 lines × 3) · ×2
  • Duplicated block (9–12 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:504 — crates/jcode-tui-account-picker/src/overlay.rs:504-515 | crates/jcode-tui-usage-overlay/src/lib.rs:512-520 | crates/jcode-tui/src/tui/login_picker.rs:410-421 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (9–12 lines × 3) crates/jcode-tui/src/tui/app/remote/reconnect.rs:353 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:353-361 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:645-656 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:682-693 — 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 (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) crates/jcode-harness-api-server/src/translate.rs:534 — crates/jcode-harness-api-server/src/translate.rs:534-545 | crates/jcode-harness-api-server/src/translate.rs:553-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 (10–12 lines × 2) crates/jcode-tui/src/tui/ui_viewport.rs:885 — crates/jcode-tui/src/tui/ui_viewport.rs:885-896 | crates/jcode-tui/src/tui/ui_viewport.rs:958-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 × 5) · ×2
  • Duplicated block (9 lines × 5) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1222 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1222-1230 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1233-1241 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1254-1262 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1265-1273 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1276-1284 — 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 (9 lines × 5) scripts/count_idle_draws.py:89 — scripts/count_idle_draws.py:89-97 | scripts/pin_no_area_state.py:74-82 | scripts/probe_idle_state.py:135-143 | scripts/profile_idle_donut.py:92-100 | scripts/which_overlay_blocks_donut.py:78-86 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×2
  • Duplicated block (9 lines × 4) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1633 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1633-1641 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1690-1698 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1725-1733 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1760-1768 — 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/jcode-app-core/src/server/debug_server_state.rs:732 — crates/jcode-app-core/src/server/debug_server_state.rs:732-740 | crates/jcode-app-core/src/server/debug_server_state.rs:742-750 | crates/jcode-app-core/src/server/debug_server_state.rs:752-760 | crates/jcode-app-core/src/server/debug_server_state.rs:762-770 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×2
  • Duplicated block (7–9 lines × 2) crates/jcode-base/src/provider/mod.rs:1725 — crates/jcode-base/src/provider/mod.rs:1725-1733 | crates/jcode-base/src/provider/mod.rs:1945-1951 — both copies are in the same file, so extract the block into 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–9 lines × 2) scripts/profile_idle_donut.py:116 — scripts/profile_idle_donut.py:116-124 | scripts/profile_real_spawn.py:61-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 × 4) · ×2
  • Duplicated block (6–7 lines × 4) crates/jcode-base/src/auth/google.rs:389 — crates/jcode-base/src/auth/google.rs:389-395 | crates/jcode-base/src/auth/oauth.rs:509-514 | crates/jcode-base/src/auth/oauth.rs:540-546 | crates/jcode-base/src/auth/oauth.rs:901-906 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6–7 lines × 4) scripts/diagnose_idle_render_cost.py:314 — scripts/diagnose_idle_render_cost.py:314-320 | scripts/repro_input_flicker.py:465-470 | scripts/repro_input_lag.py:437-442 | scripts/repro_slash_flicker.py:341-347 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) src/bin/memory_recall_bench.rs:1230 — src/bin/memory_recall_bench.rs:1230-1234 | src/bin/memory_recall_bench.rs:1468-1472 | src/bin/memory_recall_bench.rs:1600-1604 | src/bin/memory_recall_bench.rs:1843-1847 | src/bin/memory_recall_bench.rs:1866-1870 — 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 (5 lines × 5) crates/jcode-tui/src/tui/ui_overlays.rs:347 — crates/jcode-tui/src/tui/ui_overlays.rs:347-353 | crates/jcode-tui/src/tui/ui_overlays.rs:437-443 | crates/jcode-tui/src/tui/ui_overlays.rs:456-460 | crates/jcode-tui/src/tui/ui_overlays.rs:478-484 | crates/jcode-tui/src/tui/ui_overlays.rs:619-625 — 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 (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) scripts/analyze_runtime_memory_log.py:845 — scripts/analyze_runtime_memory_log.py:845-858 | scripts/analyze_runtime_memory_log.py:935-946 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/analyze_runtime_memory_log.py:845` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–14 lines × 2) scripts/diagnose_idle_render_cost.py:365 — scripts/diagnose_idle_render_cost.py:365-378 | scripts/probe_idle_state.py:127-138 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/diagnose_idle_render_cost.py:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 7) · ×2
  • Duplicated block (7 lines × 7) scripts/count_idle_draws.py:79 — scripts/count_idle_draws.py:79-85 | scripts/diagnose_idle_render_cost.py:363-369 | scripts/pin_no_area_state.py:65-71 | scripts/probe_idle_state.py:125-131 | scripts/profile_idle_donut.py:83-89 | scripts/which_overlay_blocks_donut.py:69-75 | scripts/why_no_animation_area.py:60-66 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 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 (7 lines × 7) scripts/count_idle_draws.py:87 — scripts/count_idle_draws.py:87-93 | scripts/diagnose_idle_render_cost.py:373-379 | scripts/pin_no_area_state.py:72-78 | scripts/probe_idle_state.py:133-139 | scripts/profile_idle_donut.py:90-96 | scripts/which_overlay_blocks_donut.py:76-82 | scripts/why_no_animation_area.py:67-73 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 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.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:876 — crates/jcode-provider-doctor/src/provider_e2e.rs:876-889 | crates/jcode-provider-doctor/src/provider_e2e.rs:1219-1232 | crates/jcode-provider-doctor/src/provider_e2e.rs:1871-1884 | crates/jcode-provider-doctor/src/provider_e2e.rs:2187-2200 — 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 (14 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:893 — crates/jcode-provider-doctor/src/provider_e2e.rs:893-906 | crates/jcode-provider-doctor/src/provider_e2e.rs:1236-1249 | crates/jcode-provider-doctor/src/provider_e2e.rs:1888-1901 | crates/jcode-provider-doctor/src/provider_e2e.rs:2204-2217 — 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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×2
  • Sync-over-async blocking crates/jcode-app-core/src/server.rs:2448 — `run` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking crates/jcode-codemode/src/engine.rs:97 — `run` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
C1 · Data Protection · No data-protection/encryption · ×1
  • No data-protection/encryption telemetry-worker/schema.sql:7 — No encryption usage (RustCrypto's aes-gcm/chacha20poly1305 encrypting, ring or aws-lc-rs aead sealing, orion, libsodium's secretbox, openssl symm, age, SQLCipher keyed by PRAGMA key, pgcrypto, MongoDB client-side field-level encryption, the OS keyring) was found, and this repository persists personal data in the model cited here — sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore.
D1 · Cyclomatic Complexity · Config · ×1
  • Config::apply_env_overrides (cyclomatic 306) crates/jcode-base/src/config/env_overrides.rs:9 — Config::apply_env_overrides has cyclomatic complexity 306 (threshold 15). Of this number, 303 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · insertEvent (cyclomatic 135) · ×1
  • insertEvent (cyclomatic 135) telemetry-worker/src/worker.js:1143 — insertEvent has cyclomatic complexity 135 (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 · CommunicateTool · ×1
  • CommunicateTool::execute (cyclomatic 122) crates/jcode-app-core/src/tool/communicate.rs:2017 — CommunicateTool::execute has cyclomatic complexity 122 (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 · jcode_provider_openrouter · ×1
  • jcode_provider_openrouter::request::build_chat_messages (cyclomatic 95) crates/jcode-provider-openrouter/src/request.rs:49 — jcode_provider_openrouter::request::build_chat_messages has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_tui_anim · ×1
  • jcode_tui_anim::shape_char_3x3 (cyclomatic 91) crates/jcode-tui-anim/src/lib.rs:384 — jcode_tui_anim::shape_char_3x3 has cyclomatic complexity 91 (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 · analyze_runtime_memory_log.print_human (cyclomatic 69) · ×1
  • analyze_runtime_memory_log.print_human (cyclomatic 69) scripts/analyze_runtime_memory_log.py:1073 — analyze_runtime_memory_log.print_human has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetch (cyclomatic 61) · ×1
  • fetch (cyclomatic 61) telemetry-worker/src/worker.js:505 — fetch has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GmailTool · ×1
  • GmailTool::execute (cyclomatic 54) crates/jcode-app-core/src/tool/gmail.rs:155 — GmailTool::execute has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · insertTurnDetails (cyclomatic 49) · ×1
  • insertTurnDetails (cyclomatic 49) telemetry-worker/src/worker.js:1539 — insertTurnDetails has cyclomatic complexity 49 (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 · benchmark_discovery_rate.run_trial (cyclomatic 48) · ×1
  • benchmark_discovery_rate.run_trial (cyclomatic 48) scripts/benchmark_discovery_rate.py:393 — benchmark_discovery_rate.run_trial has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · repro_input_flicker.main (cyclomatic 48) · ×1
  • repro_input_flicker.main (cyclomatic 48) scripts/repro_input_flicker.py:464 — repro_input_flicker.main has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIProvider · ×1
  • OpenAIProvider::complete (cyclomatic 47) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:185 — OpenAIProvider::complete has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionReducer.reduceEvent (cyclomatic 47) · ×1
  • SessionReducer.reduceEvent (cyclomatic 47) ios/Sources/JCodeKit/SessionReducer.swift:237 — SessionReducer.reduceEvent has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · repro_input_lag.main (cyclomatic 44) · ×1
  • repro_input_lag.main (cyclomatic 44) scripts/repro_input_lag.py:436 — repro_input_lag.main has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenRouterStream · ×1
  • OpenRouterStream::parse_next_event (cyclomatic 43) crates/jcode-provider-openrouter/src/stream.rs:273 — OpenRouterStream::parse_next_event 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 · JcodeClient.globalEvents (cyclomatic 42) · ×1
  • JcodeClient.globalEvents (cyclomatic 42) sdk/typescript/src/client.ts:1134 — JcodeClient.globalEvents has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to 7 function items inside it that branch (startChild, scan, finish, …). 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 · concurrency.classifyConcurrency (cyclomatic 40) · ×1
  • concurrency.classifyConcurrency (cyclomatic 40) telemetry-worker/src/concurrency.js:20 — concurrency.classifyConcurrency has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · worker.isMeaningfulLifecycleEvent (cyclomatic 40) · ×1
  • worker.isMeaningfulLifecycleEvent (cyclomatic 40) telemetry-worker/src/worker.js:1711 — worker.isMeaningfulLifecycleEvent has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · jcode_tui_tool_display · ×1
  • jcode_tui_tool_display::parse_tool_failure (cyclomatic 39) crates/jcode-tui-tool-display/src/lib.rs:208 — jcode_tui_tool_display::parse_tool_failure 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 · analyze_root_crate.main (cyclomatic 39) · ×1
  • analyze_root_crate.main (cyclomatic 39) scripts/analyze_root_crate.py:318 — analyze_root_crate.main 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 · ResponsesStream · ×1
  • ResponsesStream::parse_event (cyclomatic 38) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:208 — ResponsesStream::parse_event 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 · audit_terminal_bench_submission.main (cyclomatic 38) · ×1
  • audit_terminal_bench_submission.main (cyclomatic 38) scripts/audit_terminal_bench_submission.py:46 — audit_terminal_bench_submission.main 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 · oauth-account.oauthAccount (cyclomatic 38) · ×1
  • oauth-account.oauthAccount (cyclomatic 38) telemetry-worker/src/oauth-account.js:14 — oauth-account.oauthAccount has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · normalizeUsageReportEvent (cyclomatic 38) · ×1
  • normalizeUsageReportEvent (cyclomatic 38) telemetry-worker/src/worker.js:2323 — normalizeUsageReportEvent 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. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · ApplyPatchTool · ×1
  • ApplyPatchTool::execute (cyclomatic 37) crates/jcode-app-core/src/tool/apply_patch.rs:94 — ApplyPatchTool::execute has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BgTool · ×1
  • BgTool::execute (cyclomatic 35) crates/jcode-app-core/src/tool/bg.rs:516 — BgTool::execute 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 · Listener · ×1
  • Listener::poll (cyclomatic 35) crates/jcode-voice/src/global/hotkey.rs:694 — Listener::poll 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 · insertSessionDetails (cyclomatic 35) · ×1
  • insertSessionDetails (cyclomatic 35) telemetry-worker/src/worker.js:1753 — insertSessionDetails 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. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · jcode_plan · ×1
  • jcode_plan::mermaid::swarm_plan_mermaid (cyclomatic 33) crates/jcode-plan/src/mermaid.rs:40 — jcode_plan::mermaid::swarm_plan_mermaid 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 · worker.normalizeWebEvent (cyclomatic 33) · ×1
  • worker.normalizeWebEvent (cyclomatic 33) telemetry-worker/src/worker.js:2062 — worker.normalizeWebEvent 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 · MemoryTool · ×1
  • MemoryTool::execute (cyclomatic 31) crates/jcode-app-core/src/tool/memory.rs:129 — MemoryTool::execute has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · analyze_runtime_memory_log.build_incident_assessment (cyclomatic 31) · ×1
  • analyze_runtime_memory_log.build_incident_assessment (cyclomatic 31) scripts/analyze_runtime_memory_log.py:653 — analyze_runtime_memory_log.build_incident_assessment has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FollowUpPolicy · ×1
  • FollowUpPolicy::decide_after_turn (cyclomatic 30) crates/jcode-todo-policy/src/followup.rs:256 — FollowUpPolicy::decide_after_turn 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 · InfoWidgetData · ×1
  • InfoWidgetData::has_data_for (cyclomatic 30) crates/jcode-tui/src/tui/info_widget.rs:768 — InfoWidgetData::has_data_for 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.
D1 · Cyclomatic Complexity · analyze_runtime_memory_log.build_server_hints (cyclomatic 30) · ×1
  • analyze_runtime_memory_log.build_server_hints (cyclomatic 30) scripts/analyze_runtime_memory_log.py:827 — analyze_runtime_memory_log.build_server_hints 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 · launch.launchInstance (cyclomatic 30) · ×1
  • launch.launchInstance (cyclomatic 30) sdk/typescript/src/launch.ts:522 — launch.launchInstance has cyclomatic complexity 30 (threshold 15). Of this number, 15 points are the body's own statements and 15 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 · jcode_provider_copilot · ×1
  • jcode_provider_copilot::build_messages (cyclomatic 29) crates/jcode-provider-copilot/src/lib.rs:67 — jcode_provider_copilot::build_messages 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 · jcode_provider_doctor · ×1
  • jcode_provider_doctor::live_provider_probes::consume_native_stream (cyclomatic 29) crates/jcode-provider-doctor/src/live_provider_probes.rs:595 — jcode_provider_doctor::live_provider_probes::consume_native_stream 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 · benchmark_discovery_rate.load_cases (cyclomatic 29) · ×1
  • benchmark_discovery_rate.load_cases (cyclomatic 29) scripts/benchmark_discovery_rate.py:249 — benchmark_discovery_rate.load_cases 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 · benchmark_attribution.check_sponsor (cyclomatic 28) · ×1
  • benchmark_attribution.check_sponsor (cyclomatic 28) scripts/benchmark_attribution.py:256 — benchmark_attribution.check_sponsor has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · insertTodoSessionDetails (cyclomatic 28) · ×1
  • insertTodoSessionDetails (cyclomatic 28) telemetry-worker/src/worker.js:1975 — insertTodoSessionDetails 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. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · jcode_harness_api · ×1
  • jcode_harness_api::edit_stats::count_legacy_messages (cyclomatic 27) crates/jcode-harness-api/src/edit_stats.rs:128 — jcode_harness_api::edit_stats::count_legacy_messages 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 · Parser · ×1
  • Parser::parse_command (cyclomatic 27) crates/jcode-render-core/src/math.rs:349 — Parser::parse_command 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: jcode_render_core::math::command_symbol (cyclomatic 141) 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 · score_shard.score (cyclomatic 27) · ×1
  • score_shard.score (cyclomatic 27) score_shard.py:4 — score_shard.score 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 · profile_spawn.main (cyclomatic 27) · ×1
  • profile_spawn.main (cyclomatic 27) scripts/profile_spawn.py:544 — profile_spawn.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 · repro_live_duplicate.main (cyclomatic 27) · ×1
  • repro_live_duplicate.main (cyclomatic 27) scripts/repro_live_duplicate.py:436 — repro_live_duplicate.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 · pruneOldEvents (cyclomatic 27) · ×1
  • pruneOldEvents (cyclomatic 27) telemetry-worker/src/worker.js:1015 — pruneOldEvents has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · PermissionsApp · ×1
  • PermissionsApp::run (cyclomatic 26) crates/jcode-tui-permissions/src/lib.rs:509 — PermissionsApp::run 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 · jcode_tui_style · ×1
  • jcode_tui_style::harmony::generate::separate_confusable_pairs (cyclomatic 26) crates/jcode-tui-style/src/harmony/generate.rs:217 — jcode_tui_style::harmony::generate::separate_confusable_pairs has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_tui_visual_debug · ×1
  • jcode_tui_visual_debug::write_frame (cyclomatic 26) crates/jcode-tui-visual-debug/src/lib.rs:576 — jcode_tui_visual_debug::write_frame has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · analyze_runtime_memory_log.infer_trigger (cyclomatic 26) · ×1
  • analyze_runtime_memory_log.infer_trigger (cyclomatic 26) scripts/analyze_runtime_memory_log.py:327 — analyze_runtime_memory_log.infer_trigger has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · bench_memory_cli.run_tool (cyclomatic 26) · ×1
  • bench_memory_cli.run_tool (cyclomatic 26) scripts/bench_memory_cli.py:393 — bench_memory_cli.run_tool 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_release_ci.check_once (cyclomatic 26) · ×1
  • check_release_ci.check_once (cyclomatic 26) scripts/check_release_ci.py:96 — check_release_ci.check_once 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 · repro_slash_flicker.main (cyclomatic 26) · ×1
  • repro_slash_flicker.main (cyclomatic 26) scripts/repro_slash_flicker.py:340 — repro_slash_flicker.main has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AmbientRunnerHandle · ×1
  • AmbientRunnerHandle::run_loop (cyclomatic 25) crates/jcode-app-core/src/ambient/runner.rs:588 — AmbientRunnerHandle::run_loop 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 · GeminiProvider · ×1
  • GeminiProvider::complete (cyclomatic 25) crates/jcode-provider-gemini-runtime/src/lib.rs:714 — GeminiProvider::complete 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 · InitiativeTool · ×1
  • InitiativeTool::execute (cyclomatic 24) crates/jcode-app-core/src/tool/goal.rs:144 — InitiativeTool::execute has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_harness_api_server · ×1
  • jcode_harness_api_server::run_bridge_stream (cyclomatic 24) crates/jcode-harness-api-server/src/lib.rs:315 — jcode_harness_api_server::run_bridge_stream 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 · benchmark_browser_handoff.extract_trace (cyclomatic 24) · ×1
  • benchmark_browser_handoff.extract_trace (cyclomatic 24) scripts/benchmark_browser_handoff.py:180 — benchmark_browser_handoff.extract_trace 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 · count_idle_draws.main (cyclomatic 24) · ×1
  • count_idle_draws.main (cyclomatic 24) scripts/count_idle_draws.py:45 — count_idle_draws.main 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 · profile_remote_resume_burst.run_burst (cyclomatic 24) · ×1
  • profile_remote_resume_burst.run_burst (cyclomatic 24) scripts/profile_remote_resume_burst.py:219 — profile_remote_resume_burst.run_burst 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 · update_rehearsal.main (cyclomatic 24) · ×1
  • update_rehearsal.main (cyclomatic 24) scripts/update_rehearsal.py:449 — update_rehearsal.main 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 · AntigravityProvider · ×1
  • AntigravityProvider::complete (cyclomatic 23) crates/jcode-provider-antigravity-runtime/src/lib.rs:446 — AntigravityProvider::complete 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 · jcode_provider_openrouter_runtime · ×1
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response (cyclomatic 23) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:192 — jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response 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 · analyze_openai_ws_cache.analyze (cyclomatic 23) · ×1
  • analyze_openai_ws_cache.analyze (cyclomatic 23) scripts/analyze_openai_ws_cache.py:48 — analyze_openai_ws_cache.analyze 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 · benchmark_discovery.load_cases (cyclomatic 23) · ×1
  • benchmark_discovery.load_cases (cyclomatic 23) scripts/benchmark_discovery.py:134 — benchmark_discovery.load_cases 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 · benchmark_discovery.run_attempt (cyclomatic 23) · ×1
  • benchmark_discovery.run_attempt (cyclomatic 23) scripts/benchmark_discovery.py:437 — benchmark_discovery.run_attempt 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 · reload_recovery_audit.render_table (cyclomatic 23) · ×1
  • reload_recovery_audit.render_table (cyclomatic 23) scripts/reload_recovery_audit.py:518 — reload_recovery_audit.render_table 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 · Projection · ×1
  • Projection::observe (cyclomatic 22) crates/jcode-app-core/src/server/live_status.rs:57 — Projection::observe has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConversationSearchTool · ×1
  • ConversationSearchTool::execute (cyclomatic 22) crates/jcode-app-core/src/tool/conversation_search.rs:83 — ConversationSearchTool::execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Walk · ×1
  • Walk::node (cyclomatic 22) crates/jcode-applet-types/src/validate.rs:213 — Walk::node 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 · SshConnectOptions · ×1
  • SshConnectOptions::validate (cyclomatic 22) crates/jcode-sdk/src/ssh.rs:82 — SshConnectOptions::validate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · analyze_runtime_memory_log.build_client_hints (cyclomatic 22) · ×1
  • analyze_runtime_memory_log.build_client_hints (cyclomatic 22) scripts/analyze_runtime_memory_log.py:922 — analyze_runtime_memory_log.build_client_hints 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 · bench_startup_visible_ready.run_once (cyclomatic 22) · ×1
  • bench_startup_visible_ready.run_once (cyclomatic 22) scripts/bench_startup_visible_ready.py:171 — bench_startup_visible_ready.run_once 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 · verify_donut_still_animates.main (cyclomatic 22) · ×1
  • verify_donut_still_animates.main (cyclomatic 22) scripts/verify_donut_still_animates.py:68 — verify_donut_still_animates.main 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 · AppletTool · ×1
  • AppletTool::execute (cyclomatic 21) crates/jcode-app-core/src/tool/applet.rs:228 — AppletTool::execute 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 · TodoTool · ×1
  • TodoTool::execute (cyclomatic 21) crates/jcode-app-core/src/tool/todo.rs:1412 — TodoTool::execute 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 · jcode_terminal_image · ×1
  • jcode_terminal_image::display::get_image_dimensions (cyclomatic 21) crates/jcode-terminal-image/src/display.rs:229 — jcode_terminal_image::display::get_image_dimensions 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 · bench_resume_picker.measure (cyclomatic 21) · ×1
  • bench_resume_picker.measure (cyclomatic 21) scripts/bench_resume_picker.py:27 — bench_resume_picker.measure 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 · benchmark_attribution.main (cyclomatic 21) · ×1
  • benchmark_attribution.main (cyclomatic 21) scripts/benchmark_attribution.py:360 — benchmark_attribution.main has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · benchmark_browser_handoff.summarize (cyclomatic 21) · ×1
  • benchmark_browser_handoff.summarize (cyclomatic 21) scripts/benchmark_browser_handoff.py:390 — benchmark_browser_handoff.summarize 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 · profile_spawn.profile_client_spawn (cyclomatic 21) · ×1
  • profile_spawn.profile_client_spawn (cyclomatic 21) scripts/profile_spawn.py:403 — profile_spawn.profile_client_spawn 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 · launch.inheritCredentials (cyclomatic 21) · ×1
  • launch.inheritCredentials (cyclomatic 21) sdk/typescript/src/launch.ts:242 — launch.inheritCredentials 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 · writeFirehose (cyclomatic 21) · ×1
  • writeFirehose (cyclomatic 21) telemetry-worker/src/worker.js:369 — writeFirehose has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · insertWebDetails (cyclomatic 21) · ×1
  • insertWebDetails (cyclomatic 21) telemetry-worker/src/worker.js:2011 — insertWebDetails has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 · CalendarTool · ×1
  • CalendarTool::execute (cyclomatic 20) crates/jcode-app-core/src/tool/calendar.rs:317 — CalendarTool::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 · RouteSelection · ×1
  • RouteSelection::routed_model_spec (cyclomatic 20) crates/jcode-provider-core/src/lib.rs:1044 — RouteSelection::routed_model_spec 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 · profile_idle_donut.main (cyclomatic 20) · ×1
  • profile_idle_donut.main (cyclomatic 20) scripts/profile_idle_donut.py:48 — profile_idle_donut.main 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 · reload_recovery_audit.parse_logs (cyclomatic 20) · ×1
  • reload_recovery_audit.parse_logs (cyclomatic 20) scripts/reload_recovery_audit.py:244 — reload_recovery_audit.parse_logs 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 · remote_check.main (cyclomatic 20) · ×1
  • remote_check.main (cyclomatic 20) scripts/remote/remote_check.py:42 — remote_check.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 · repro_input_flicker.observe_keystroke (cyclomatic 20) · ×1
  • repro_input_flicker.observe_keystroke (cyclomatic 20) scripts/repro_input_flicker.py:388 — repro_input_flicker.observe_keystroke 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 · repro_real_spawn_lag.main (cyclomatic 20) · ×1
  • repro_real_spawn_lag.main (cyclomatic 20) scripts/repro_real_spawn_lag.py:131 — repro_real_spawn_lag.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 · repro_startup_lag.main (cyclomatic 20) · ×1
  • repro_startup_lag.main (cyclomatic 20) scripts/repro_startup_lag.py:72 — repro_startup_lag.main 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 · resolvePriceRows (cyclomatic 20) · ×1
  • resolvePriceRows (cyclomatic 20) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows 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 · analyze_root_crate.outbound_refs (cyclomatic 19) · ×1
  • analyze_root_crate.outbound_refs (cyclomatic 19) scripts/analyze_root_crate.py:204 — analyze_root_crate.outbound_refs 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 · apply_release_recovery.apply (cyclomatic 19) · ×1
  • apply_release_recovery.apply (cyclomatic 19) scripts/apply_release_recovery.py:24 — apply_release_recovery.apply has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · benchmark_discovery.summarize_case (cyclomatic 19) · ×1
  • benchmark_discovery.summarize_case (cyclomatic 19) scripts/benchmark_discovery.py:625 — benchmark_discovery.summarize_case has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worker.normalizeDiscoveryEvent (cyclomatic 19) · ×1
  • worker.normalizeDiscoveryEvent (cyclomatic 19) telemetry-worker/src/worker.js:2203 — worker.normalizeDiscoveryEvent 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 · DiscoverToolsTool · ×1
  • DiscoverToolsTool::execute (cyclomatic 18) crates/jcode-app-core/src/tool/discover.rs:527 — DiscoverToolsTool::execute has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DeflateStream · ×1
  • DeflateStream::accept_write (cyclomatic 18) crates/jcode-provider-core/src/ws_deflate.rs:413 — DeflateStream::accept_write 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 · EndpointInfo · ×1
  • EndpointInfo::detail_string (cyclomatic 18) crates/jcode-provider-openrouter/src/lib.rs:134 — EndpointInfo::detail_string 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 · FlowInner · ×1
  • FlowInner::execute (cyclomatic 18) crates/jcode-sdk/src/auth.rs:518 — FlowInner::execute 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 · bench_headless_memory.run_jcode (cyclomatic 18) · ×1
  • bench_headless_memory.run_jcode (cyclomatic 18) scripts/bench_headless_memory.py:82 — bench_headless_memory.run_jcode 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 · benchmark_browser_handoff.main (cyclomatic 18) · ×1
  • benchmark_browser_handoff.main (cyclomatic 18) scripts/benchmark_browser_handoff.py:595 — benchmark_browser_handoff.main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · benchmark_swarm.run_swarm (cyclomatic 18) · ×1
  • benchmark_swarm.run_swarm (cyclomatic 18) scripts/benchmark_swarm.py:326 — benchmark_swarm.run_swarm 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 · measure_animation_cpu_cost.main (cyclomatic 18) · ×1
  • measure_animation_cpu_cost.main (cyclomatic 18) scripts/measure_animation_cpu_cost.py:138 — measure_animation_cpu_cost.main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wake-lambda.handler (cyclomatic 18) · ×1
  • wake-lambda.handler (cyclomatic 18) scripts/phone-server/wake-lambda.py:156 — wake-lambda.handler 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 · pin_no_area_state.main (cyclomatic 18) · ×1
  • pin_no_area_state.main (cyclomatic 18) scripts/pin_no_area_state.py:38 — pin_no_area_state.main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JcodeClient.run (cyclomatic 18) · ×1
  • JcodeClient.run (cyclomatic 18) sdk/typescript/src/client.ts:1343 — JcodeClient.run has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpClient · ×1
  • McpClient::connect_in_dir (cyclomatic 17) crates/jcode-base/src/mcp/client.rs:195 — McpClient::connect_in_dir 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 · jcode_compaction_core · ×1
  • jcode_compaction_core::build_compaction_conversation_text (cyclomatic 17) crates/jcode-compaction-core/src/lib.rs:162 — jcode_compaction_core::build_compaction_conversation_text 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 · jcode_memory_types · ×1
  • jcode_memory_types::format_entries_for_prompt_with_header (cyclomatic 17) crates/jcode-memory-types/src/lib.rs:664 — jcode_memory_types::format_entries_for_prompt_with_header has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · jcode_storage · ×1
  • jcode_storage::run_windows_hardening_worker (cyclomatic 17) crates/jcode-storage/src/lib.rs:358 — jcode_storage::run_windows_hardening_worker 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 · AnchorStabilityRecorder · ×1
  • AnchorStabilityRecorder::observe (cyclomatic 17) crates/jcode-tui-core/src/anchor_stability.rs:212 — AnchorStabilityRecorder::observe 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 · Decoder · ×1
  • Decoder::event (cyclomatic 17) crates/jcode-voice/src/global/hotkey.rs:348 — Decoder::event has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · EventMapper · ×1
  • EventMapper::map_event (cyclomatic 17) src/cli/acp.rs:1497 — EventMapper::map_event 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 · analyze_runtime_memory_log.collect_session_peaks (cyclomatic 17) · ×1
  • analyze_runtime_memory_log.collect_session_peaks (cyclomatic 17) scripts/analyze_runtime_memory_log.py:437 — analyze_runtime_memory_log.collect_session_peaks 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 · analyze_runtime_memory_log.build_coverage_report (cyclomatic 17) · ×1
  • analyze_runtime_memory_log.build_coverage_report (cyclomatic 17) scripts/analyze_runtime_memory_log.py:476 — analyze_runtime_memory_log.build_coverage_report 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 · benchmark_discovery.main (cyclomatic 17) · ×1
  • benchmark_discovery.main (cyclomatic 17) scripts/benchmark_discovery.py:741 — benchmark_discovery.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 · benchmark_discovery_rate.summarize_case (cyclomatic 17) · ×1
  • benchmark_discovery_rate.summarize_case (cyclomatic 17) scripts/benchmark_discovery_rate.py:563 — benchmark_discovery_rate.summarize_case 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 · check_swallowed_error_budget.main (cyclomatic 17) · ×1
  • check_swallowed_error_budget.main (cyclomatic 17) scripts/check_swallowed_error_budget.py:182 — check_swallowed_error_budget.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 · dump_fresh_spawn_screen.main (cyclomatic 17) · ×1
  • dump_fresh_spawn_screen.main (cyclomatic 17) scripts/dump_fresh_spawn_screen.py:30 — dump_fresh_spawn_screen.main has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · H.do_POST (cyclomatic 17) · ×1
  • H.do_POST (cyclomatic 17) scripts/fake_openai_server.py:42 — H.do_POST 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 · JcodeHarborAgent.run (cyclomatic 17) · ×1
  • JcodeHarborAgent.run (cyclomatic 17) scripts/jcode_harbor_agent.py:233 — JcodeHarborAgent.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 · jcode_memory_snapshot.classify_process (cyclomatic 17) · ×1
  • jcode_memory_snapshot.classify_process (cyclomatic 17) scripts/jcode_memory_snapshot.py:113 — jcode_memory_snapshot.classify_process 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 · profile_single_spawn.profile_single_spawn (cyclomatic 17) · ×1
  • profile_single_spawn.profile_single_spawn (cyclomatic 17) scripts/profile_single_spawn.py:113 — profile_single_spawn.profile_single_spawn 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 · tb_compare.main (cyclomatic 17) · ×1
  • tb_compare.main (cyclomatic 17) scripts/tb_compare.py:53 — tb_compare.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 · worker.validateTranscript (cyclomatic 17) · ×1
  • worker.validateTranscript (cyclomatic 17) telemetry-worker/src/worker.js:857 — worker.validateTranscript has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · jcode_core · ×1
  • jcode_core::util::split_concatenated_json (cyclomatic 16) crates/jcode-core/src/util.rs:176 — jcode_core::util::split_concatenated_json 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 · Snapshot · ×1
  • Snapshot::row (cyclomatic 16) crates/jcode-tui/src/tui/justrust_status.rs:158 — Snapshot::row 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 · jcode_update_core · ×1
  • jcode_update_core::known_update_error_summary (cyclomatic 16) crates/jcode-update-core/src/lib.rs:286 — jcode_update_core::known_update_error_summary has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TranscriptState · ×1
  • TranscriptState::apply (cyclomatic 16) crates/jcode-voice/src/nari.rs:535 — TranscriptState::apply has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · analyze_runtime_memory_log.session_population_summary (cyclomatic 16) · ×1
  • analyze_runtime_memory_log.session_population_summary (cyclomatic 16) scripts/analyze_runtime_memory_log.py:607 — analyze_runtime_memory_log.session_population_summary 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 · bench_memory_cli.launch_interactive (cyclomatic 16) · ×1
  • bench_memory_cli.launch_interactive (cyclomatic 16) scripts/bench_memory_cli.py:221 — bench_memory_cli.launch_interactive 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 · benchmark_browser_handoff.run_trial (cyclomatic 16) · ×1
  • benchmark_browser_handoff.run_trial (cyclomatic 16) scripts/benchmark_browser_handoff.py:317 — benchmark_browser_handoff.run_trial 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 · benchmark_browser_handoff.self_test (cyclomatic 16) · ×1
  • benchmark_browser_handoff.self_test (cyclomatic 16) scripts/benchmark_browser_handoff.py:436 — benchmark_browser_handoff.self_test 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 · diagnose_idle_render_cost.main (cyclomatic 16) · ×1
  • diagnose_idle_render_cost.main (cyclomatic 16) scripts/diagnose_idle_render_cost.py:313 — diagnose_idle_render_cost.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 · run_terminal_bench_campaign.main (cyclomatic 16) · ×1
  • run_terminal_bench_campaign.main (cyclomatic 16) scripts/run_terminal_bench_campaign.py:416 — run_terminal_bench_campaign.main has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · verify_discovery_select.main (cyclomatic 16) · ×1
  • verify_discovery_select.main (cyclomatic 16) scripts/verify_discovery_select.py:103 — verify_discovery_select.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 · worker.normalizeInstallFunnelEvent (cyclomatic 16) · ×1
  • worker.normalizeInstallFunnelEvent (cyclomatic 16) telemetry-worker/src/worker.js:2147 — worker.normalizeInstallFunnelEvent has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D10 · Test Quality · Fixed-sleep synchronisation · ×1
  • Fixed-sleep synchronisation: concurrent configuration is rejected without changing the callback table sdk/typescript/test/tools.test.ts:159 — This test starts work it did not wait for (`first`, still running when the sleep starts) and then orders itself against it with `delay(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.
D2 · Cognitive Complexity · Config · ×1
  • Config::apply_env_overrides (cognitive 410) crates/jcode-base/src/config/env_overrides.rs:9 — Config::apply_env_overrides has cognitive complexity 410 (threshold 15). Drivers by points: if/else 279 (373 pts), boolean chains 26, match/switch 4 (8 pts), loops 2 (3 pts) (nesting depth added 99). Of this number, 405 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_openrouter · ×1
  • jcode_provider_openrouter::request::build_chat_messages (cognitive 239) crates/jcode-provider-openrouter/src/request.rs:49 — jcode_provider_openrouter::request::build_chat_messages has cognitive complexity 239 (threshold 15). Drivers by points: if/else 67 (173 pts), loops 19 (43 pts), match/switch 4 (13 pts), boolean chains 10 (nesting depth added 139). 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 · insertEvent (cognitive 145) · ×1
  • insertEvent (cognitive 145) telemetry-worker/src/worker.js:1143 — insertEvent has cognitive complexity 145 (threshold 15). Drivers by points: boolean chains 88, if/else 27 (36 pts), other 16, error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CommunicateTool · ×1
  • CommunicateTool::execute (cognitive 142) crates/jcode-app-core/src/tool/communicate.rs:2017 — CommunicateTool::execute has cognitive complexity 142 (threshold 15). Drivers by points: if/else 31 (66 pts), match/switch 35 (62 pts), loops 3 (8 pts), boolean chains 6 (nesting depth added 67). 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 · ApplyPatchTool · ×1
  • ApplyPatchTool::execute (cognitive 103) crates/jcode-app-core/src/tool/apply_patch.rs:94 — ApplyPatchTool::execute has cognitive complexity 103 (threshold 15). Drivers by points: if/else 31 (81 pts), loops 6 (10 pts), match/switch 4 (7 pts), boolean chains 5 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repro_input_flicker.main (cognitive 101) · ×1
  • repro_input_flicker.main (cognitive 101) scripts/repro_input_flicker.py:464 — repro_input_flicker.main has cognitive complexity 101 (threshold 15). Drivers by points: if/else 28 (56 pts), loops 10 (25 pts), error handling 3 (8 pts), ternaries 3 (8 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · analyze_runtime_memory_log.print_human (cognitive 98) · ×1
  • analyze_runtime_memory_log.print_human (cognitive 98) scripts/analyze_runtime_memory_log.py:1073 — analyze_runtime_memory_log.print_human has cognitive complexity 98 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 27, loops 12 (21 pts), ternaries 7 (17 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 · GmailTool · ×1
  • GmailTool::execute (cognitive 91) crates/jcode-app-core/src/tool/gmail.rs:155 — GmailTool::execute has cognitive complexity 91 (threshold 15). Drivers by points: if/else 32 (60 pts), loops 8 (16 pts), match/switch 6 (14 pts), boolean chains 1 (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 · jcode_provider_copilot · ×1
  • jcode_provider_copilot::build_messages (cognitive 85) crates/jcode-provider-copilot/src/lib.rs:67 — jcode_provider_copilot::build_messages has cognitive complexity 85 (threshold 15). Drivers by points: if/else 18 (55 pts), loops 7 (19 pts), match/switch 3 (10 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIProvider · ×1
  • OpenAIProvider::complete (cognitive 85) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:185 — OpenAIProvider::complete has cognitive complexity 85 (threshold 15). Drivers by points: if/else 37 (70 pts), match/switch 6 (12 pts), boolean chains 2, loops 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audit_terminal_bench_submission.main (cognitive 77) · ×1
  • audit_terminal_bench_submission.main (cognitive 77) scripts/audit_terminal_bench_submission.py:46 — audit_terminal_bench_submission.main has cognitive complexity 77 (threshold 15). Drivers by points: if/else 21 (51 pts), loops 9 (14 pts), error handling 2 (6 pts), boolean chains 5, ternaries 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_discovery_rate.run_trial (cognitive 74) · ×1
  • benchmark_discovery_rate.run_trial (cognitive 74) scripts/benchmark_discovery_rate.py:393 — benchmark_discovery_rate.run_trial has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (53 pts), boolean chains 11, error handling 3 (6 pts), loops 2, ternaries 1 (2 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.
D2 · Cognitive Complexity · fetch (cognitive 68) · ×1
  • fetch (cognitive 68) telemetry-worker/src/worker.js:505 — fetch has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31 (42 pts), boolean chains 18, error handling 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_openai_ws_cache.analyze (cognitive 67) · ×1
  • analyze_openai_ws_cache.analyze (cognitive 67) scripts/analyze_openai_ws_cache.py:48 — analyze_openai_ws_cache.analyze has cognitive complexity 67 (threshold 15). Drivers by points: if/else 13 (51 pts), error handling 3 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MemoryTool · ×1
  • MemoryTool::execute (cognitive 64) crates/jcode-app-core/src/tool/memory.rs:129 — MemoryTool::execute has cognitive complexity 64 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 5 (15 pts), match/switch 4 (9 pts) (nesting depth added 33). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · jcode_protocol · ×1
  • jcode_protocol::comm_format::format_comm_members (cognitive 64) crates/jcode-protocol/src/comm_format.rs:134 — jcode_protocol::comm_format::format_comm_members has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 8 (25 pts), boolean chains 4, loops 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 · jcode_harness_api_server · ×1
  • jcode_harness_api_server::run_bridge_stream (cognitive 63) crates/jcode-harness-api-server/src/lib.rs:315 — jcode_harness_api_server::run_bridge_stream has cognitive complexity 63 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 7 (20 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repro_input_lag.main (cognitive 62) · ×1
  • repro_input_lag.main (cognitive 62) scripts/repro_input_lag.py:436 — repro_input_lag.main has cognitive complexity 62 (threshold 15). Drivers by points: if/else 28 (37 pts), error handling 4 (7 pts), ternaries 5 (7 pts), loops 5 (6 pts), boolean chains 5 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BgTool · ×1
  • BgTool::execute (cognitive 61) crates/jcode-app-core/src/tool/bg.rs:516 — BgTool::execute has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (37 pts), match/switch 7 (15 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 34). 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 · profile_spawn.main (cognitive 58) · ×1
  • profile_spawn.main (cognitive 58) scripts/profile_spawn.py:544 — profile_spawn.main has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 3 (7 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reload_recovery_audit.parse_logs (cognitive 58) · ×1
  • reload_recovery_audit.parse_logs (cognitive 58) scripts/reload_recovery_audit.py:244 — reload_recovery_audit.parse_logs has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (53 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_root_crate.main (cognitive 57) · ×1
  • analyze_root_crate.main (cognitive 57) scripts/analyze_root_crate.py:318 — analyze_root_crate.main has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 12 (19 pts), boolean chains 8, ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pruneOldEvents (cognitive 55) · ×1
  • pruneOldEvents (cognitive 55) telemetry-worker/src/worker.js:1015 — pruneOldEvents has cognitive complexity 55 (threshold 15). Drivers by points: error handling 6 (21 pts), if/else 7 (21 pts), boolean chains 6, loops 3 (4 pts), other 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Listener · ×1
  • Listener::poll (cognitive 52) crates/jcode-voice/src/global/hotkey.rs:694 — Listener::poll has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 5 (16 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConversationSearchTool · ×1
  • ConversationSearchTool::execute (cognitive 51) crates/jcode-app-core/src/tool/conversation_search.rs:83 — ConversationSearchTool::execute has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 3 (13 pts), loops 3 (10 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JcodeClient.globalEvents (cognitive 50) · ×1
  • JcodeClient.globalEvents (cognitive 50) sdk/typescript/src/client.ts:1134 — JcodeClient.globalEvents has cognitive complexity 50 (threshold 15). Drivers by points: if/else 29 (33 pts), boolean chains 7, ternaries 2 (6 pts), error handling 2, loops 2 (nesting depth added 8). Most of this is not in the body itself: 8 of the 50 points are its own statements and the rest belongs to 7 function items inside it that branch (startChild, scan, finish, …). 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 · AmbientRunnerHandle · ×1
  • AmbientRunnerHandle::run_loop (cognitive 46) crates/jcode-app-core/src/ambient/runner.rs:588 — AmbientRunnerHandle::run_loop has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 8 (21 pts), boolean chains 3, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InitiativeTool · ×1
  • InitiativeTool::execute (cognitive 46) crates/jcode-app-core/src/tool/goal.rs:144 — InitiativeTool::execute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (41 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · profile_remote_resume_burst.run_burst (cognitive 46) · ×1
  • profile_remote_resume_burst.run_burst (cognitive 46) scripts/profile_remote_resume_burst.py:219 — profile_remote_resume_burst.run_burst has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 5 (8 pts), boolean chains 6, error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · insertTurnDetails (cognitive 46) · ×1
  • insertTurnDetails (cognitive 46) telemetry-worker/src/worker.js:1539 — insertTurnDetails has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 34, other 10, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · bench_resume_picker.measure (cognitive 44) · ×1
  • bench_resume_picker.measure (cognitive 44) scripts/bench_resume_picker.py:27 — bench_resume_picker.measure has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (29 pts), error handling 3 (7 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_discovery_rate.load_cases (cognitive 44) · ×1
  • benchmark_discovery_rate.load_cases (cognitive 44) scripts/benchmark_discovery_rate.py:249 — benchmark_discovery_rate.load_cases has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 11, loops 3 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repro_live_duplicate.main (cognitive 43) · ×1
  • repro_live_duplicate.main (cognitive 43) scripts/repro_live_duplicate.py:436 — repro_live_duplicate.main has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (20 pts), error handling 7 (10 pts), loops 5 (9 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · launch.launchInstance (cognitive 43) · ×1
  • launch.launchInstance (cognitive 43) sdk/typescript/src/launch.ts:522 — launch.launchInstance has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 5 (10 pts), ternaries 4 (6 pts), loops 3 (4 pts) (nesting depth added 17). Of this number, 17 points are the body's own statements and 26 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 · TelegramChannel · ×1
  • TelegramChannel::reply_loop (cognitive 42) crates/jcode-app-core/src/channel.rs:198 — TelegramChannel::reply_loop has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 3 (10 pts), loops 2 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_root_crate.outbound_refs (cognitive 42) · ×1
  • analyze_root_crate.outbound_refs (cognitive 42) scripts/analyze_root_crate.py:204 — analyze_root_crate.outbound_refs has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 6 (15 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bench_memory_cli.run_tool (cognitive 42) · ×1
  • bench_memory_cli.run_tool (cognitive 42) scripts/bench_memory_cli.py:393 — bench_memory_cli.run_tool has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 8 (11 pts), error handling 3 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelIndex · ×1
  • ChannelIndex::remove_session (cognitive 41) crates/jcode-swarm-core/src/lib.rs:277 — ChannelIndex::remove_session has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 4 (10 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AntigravityProvider · ×1
  • AntigravityProvider::complete (cognitive 40) crates/jcode-provider-antigravity-runtime/src/lib.rs:446 — AntigravityProvider::complete has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 5 (10 pts), loops 2 (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.
D2 · Cognitive Complexity · DiscordChannel · ×1
  • DiscordChannel::reply_loop (cognitive 39) crates/jcode-app-core/src/channel.rs:397 — DiscordChannel::reply_loop has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 2 (4 pts), match/switch 2 (3 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.
D2 · Cognitive Complexity · benchmark_attribution.check_sponsor (cognitive 38) · ×1
  • benchmark_attribution.check_sponsor (cognitive 38) scripts/benchmark_attribution.py:256 — benchmark_attribution.check_sponsor has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 11, error handling 1 (2 pts), loops 1 (2 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 · concurrency.classifyConcurrency (cognitive 38) · ×1
  • concurrency.classifyConcurrency (cognitive 38) telemetry-worker/src/concurrency.js:20 — concurrency.classifyConcurrency has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 9, 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 · worker.normalizeWebEvent (cognitive 38) · ×1
  • worker.normalizeWebEvent (cognitive 38) telemetry-worker/src/worker.js:2062 — worker.normalizeWebEvent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 13, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TodoTool · ×1
  • TodoTool::execute (cognitive 37) crates/jcode-app-core/src/tool/todo.rs:1412 — TodoTool::execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bench_startup_visible_ready.run_once (cognitive 37) · ×1
  • bench_startup_visible_ready.run_once (cognitive 37) scripts/bench_startup_visible_ready.py:171 — bench_startup_visible_ready.run_once has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 5 (11 pts), boolean chains 2, loops 2, 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 · benchmark_browser_handoff.extract_trace (cognitive 37) · ×1
  • benchmark_browser_handoff.extract_trace (cognitive 37) scripts/benchmark_browser_handoff.py:180 — benchmark_browser_handoff.extract_trace has cognitive complexity 37 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 3 (12 pts), error handling 3 (8 pts), boolean chains 2, loops 2 (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 · benchmark_discovery.summarize_case (cognitive 37) · ×1
  • benchmark_discovery.summarize_case (cognitive 37) scripts/benchmark_discovery.py:625 — benchmark_discovery.summarize_case has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (6 pts), boolean chains 4, ternaries 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 · benchmark_discovery.run_benchmark (cognitive 37) · ×1
  • benchmark_discovery.run_benchmark (cognitive 37) scripts/benchmark_discovery.py:680 — benchmark_discovery.run_benchmark has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 3 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeUsageReportEvent (cognitive 37) · ×1
  • normalizeUsageReportEvent (cognitive 37) telemetry-worker/src/worker.js:2323 — normalizeUsageReportEvent has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 13, loops 2, other 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IncrementalMarkdownRenderer · ×1
  • IncrementalMarkdownRenderer::find_last_complete_block_checkpoint (cognitive 36) crates/jcode-tui-markdown/src/markdown_incremental.rs:107 — IncrementalMarkdownRenderer::find_last_complete_block_checkpoint has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 2 (4 pts), boolean chains 1, 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 · bench_memory_cli.launch_interactive (cognitive 36) · ×1
  • bench_memory_cli.launch_interactive (cognitive 36) scripts/bench_memory_cli.py:221 — bench_memory_cli.launch_interactive has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (21 pts), error handling 2 (9 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SessionReducer.reduceEvent (cognitive 36) · ×1
  • SessionReducer.reduceEvent (cognitive 36) ios/Sources/JCodeKit/SessionReducer.swift:237 — SessionReducer.reduceEvent has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · benchmark_discovery.run_attempt (cognitive 35) · ×1
  • benchmark_discovery.run_attempt (cognitive 35) scripts/benchmark_discovery.py:437 — benchmark_discovery.run_attempt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), error handling 3 (6 pts), boolean chains 5, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · profile_spawn.profile_client_spawn (cognitive 35) · ×1
  • profile_spawn.profile_client_spawn (cognitive 35) scripts/profile_spawn.py:403 — profile_spawn.profile_client_spawn has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 6 (13 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FollowUpPolicy · ×1
  • FollowUpPolicy::decide_after_turn (cognitive 34) crates/jcode-todo-policy/src/followup.rs:256 — FollowUpPolicy::decide_after_turn has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 12 (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 · AcpRuntime · ×1
  • AcpRuntime::run_prompt (cognitive 34) src/cli/acp.rs:985 — AcpRuntime::run_prompt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · score_shard.score (cognitive 34) · ×1
  • score_shard.score (cognitive 34) score_shard.py:4 — score_shard.score has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, ternaries 2 (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 · benchmark_browser_handoff.main (cognitive 34) · ×1
  • benchmark_browser_handoff.main (cognitive 34) scripts/benchmark_browser_handoff.py:595 — benchmark_browser_handoff.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (10 pts), error handling 1 (5 pts), ternaries 2 (5 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 · check_release_ci.check_once (cognitive 34) · ×1
  • check_release_ci.check_once (cognitive 34) scripts/check_release_ci.py:96 — check_release_ci.check_once has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 7, loops 2, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reload_recovery_audit.render_table (cognitive 34) · ×1
  • reload_recovery_audit.render_table (cognitive 34) scripts/reload_recovery_audit.py:518 — reload_recovery_audit.render_table has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (13 pts), loops 6 (11 pts), boolean chains 6, if/else 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpClient · ×1
  • McpClient::connect_in_dir (cognitive 33) crates/jcode-base/src/mcp/client.rs:195 — McpClient::connect_in_dir has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 2 (4 pts), loops 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 · compile_isolation_report.main (cognitive 33) · ×1
  • compile_isolation_report.main (cognitive 33) scripts/compile_isolation_report.py:172 — compile_isolation_report.main has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (11 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 · oauthAccount (cognitive 33) · ×1
  • oauthAccount (cognitive 33) telemetry-worker/src/oauth-account.js:14 — oauthAccount has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, error handling 2, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JadeRelayChannel · ×1
  • JadeRelayChannel::reply_loop (cognitive 32) crates/jcode-app-core/src/channel.rs:667 — JadeRelayChannel::reply_loop has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_doctor · ×1
  • jcode_provider_doctor::live_provider_probes::consume_native_stream (cognitive 32) crates/jcode-provider-doctor/src/live_provider_probes.rs:595 — jcode_provider_doctor::live_provider_probes::consume_native_stream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_storage · ×1
  • jcode_storage::run_windows_hardening_worker (cognitive 32) crates/jcode-storage/src/lib.rs:358 — jcode_storage::run_windows_hardening_worker has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 7 (13 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 · jcode_terminal_image · ×1
  • jcode_terminal_image::display::get_image_dimensions (cognitive 32) crates/jcode-terminal-image/src/display.rs:229 — jcode_terminal_image::display::get_image_dimensions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 9, 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 · repro_slash_flicker.main (cognitive 32) · ×1
  • repro_slash_flicker.main (cognitive 32) scripts/repro_slash_flicker.py:340 — repro_slash_flicker.main has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (19 pts), error handling 4 (6 pts), ternaries 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · insertSessionDetails (cognitive 32) · ×1
  • insertSessionDetails (cognitive 32) telemetry-worker/src/worker.js:1753 — insertSessionDetails has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 25, other 5, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · jcode_tui_visual_debug · ×1
  • jcode_tui_visual_debug::write_frame (cognitive 31) crates/jcode-tui-visual-debug/src/lib.rs:576 — jcode_tui_visual_debug::write_frame has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, loops 6 (12 pts) (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · repro_real_spawn_lag.main (cognitive 31) · ×1
  • repro_real_spawn_lag.main (cognitive 31) scripts/repro_real_spawn_lag.py:131 — repro_real_spawn_lag.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4 (8 pts), boolean chains 5, 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 · verify_donut_still_animates.main (cognitive 31) · ×1
  • verify_donut_still_animates.main (cognitive 31) scripts/verify_donut_still_animates.py:68 — verify_donut_still_animates.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (20 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 2, 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 · analyze_runtime_memory_log.build_incident_assessment (cognitive 30) · ×1
  • analyze_runtime_memory_log.build_incident_assessment (cognitive 30) scripts/analyze_runtime_memory_log.py:653 — analyze_runtime_memory_log.build_incident_assessment has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 19, ternaries 5 (8 pts), if/else 3 (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 · benchmark_discovery.load_cases (cognitive 30) · ×1
  • benchmark_discovery.load_cases (cognitive 30) scripts/benchmark_discovery.py:134 — benchmark_discovery.load_cases has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 12, 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 · benchmark_swarm.run_swarm (cognitive 30) · ×1
  • benchmark_swarm.run_swarm (cognitive 30) scripts/benchmark_swarm.py:326 — benchmark_swarm.run_swarm has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 3 (8 pts), loops 2 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · launch.inheritCredentials (cognitive 30) · ×1
  • launch.inheritCredentials (cognitive 30) sdk/typescript/src/launch.ts:242 — launch.inheritCredentials has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (6 pts), boolean chains 4, error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolvePriceRows (cognitive 30) · ×1
  • resolvePriceRows (cognitive 30) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (12 pts), other 8, ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlowInner · ×1
  • FlowInner::execute (cognitive 29) crates/jcode-sdk/src/auth.rs:518 — FlowInner::execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 1 (3 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 · analyze_runtime_memory_log.build_server_hints (cognitive 29) · ×1
  • analyze_runtime_memory_log.build_server_hints (cognitive 29) scripts/analyze_runtime_memory_log.py:827 — analyze_runtime_memory_log.build_server_hints has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 12, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · EmulatedClient._pump_inner (cognitive 29) · ×1
  • EmulatedClient._pump_inner (cognitive 29) scripts/repro_input_flicker.py:211 — EmulatedClient._pump_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (9 pts), loops 3 (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 · analyze_root_crate._module_imports (cognitive 28) · ×1
  • analyze_root_crate._module_imports (cognitive 28) scripts/analyze_root_crate.py:56 — analyze_root_crate._module_imports has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_attribution.main (cognitive 28) · ×1
  • benchmark_attribution.main (cognitive 28) scripts/benchmark_attribution.py:360 — benchmark_attribution.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4, boolean chains 3, error handling 1 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · profile_single_spawn.profile_single_spawn (cognitive 28) · ×1
  • profile_single_spawn.profile_single_spawn (cognitive 28) scripts/profile_single_spawn.py:113 — profile_single_spawn.profile_single_spawn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), error handling 6 (8 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_root_crate.top_level_modules (cognitive 27) · ×1
  • analyze_root_crate.top_level_modules (cognitive 27) scripts/analyze_root_crate.py:102 — analyze_root_crate.top_level_modules has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (9 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compare_token_usage.run_test_suite (cognitive 27) · ×1
  • compare_token_usage.run_test_suite (cognitive 27) scripts/compare_token_usage.py:324 — compare_token_usage.run_test_suite has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · count_idle_draws.main (cognitive 27) · ×1
  • count_idle_draws.main (cognitive 27) scripts/count_idle_draws.py:45 — count_idle_draws.main has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, error handling 2 (4 pts), ternaries 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · repro_input_lag.measure (cognitive 27) · ×1
  • repro_input_lag.measure (cognitive 27) scripts/repro_input_lag.py:316 — repro_input_lag.measure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (8 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 · MessagePayload · ×1
  • MessagePayload::extract_text (cognitive 26) crates/jcode-base/src/gmail.rs:1063 — MessagePayload::extract_text has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SshConnectOptions · ×1
  • SshConnectOptions::validate (cognitive 26) crates/jcode-sdk/src/ssh.rs:82 — SshConnectOptions::validate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, match/switch 2 (5 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_root_crate.eades_order (cognitive 26) · ×1
  • analyze_root_crate.eades_order (cognitive 26) scripts/analyze_root_crate.py:483 — analyze_root_crate.eades_order has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 6 (12 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 · analyze_runtime_memory_log.infer_trigger (cognitive 26) · ×1
  • analyze_runtime_memory_log.infer_trigger (cognitive 26) scripts/analyze_runtime_memory_log.py:327 — analyze_runtime_memory_log.infer_trigger has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 18, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Client._pump (cognitive 26) · ×1
  • Client._pump (cognitive 26) scripts/diagnose_idle_render_cost.py:150 — Client._pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (9 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pin_no_area_state.main (cognitive 26) · ×1
  • pin_no_area_state.main (cognitive 26) scripts/pin_no_area_state.py:38 — pin_no_area_state.main has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (6 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reload_recovery_audit.parse_trace_files (cognitive 26) · ×1
  • reload_recovery_audit.parse_trace_files (cognitive 26) scripts/reload_recovery_audit.py:415 — reload_recovery_audit.parse_trace_files has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), error handling 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gateway.events (cognitive 26) · ×1
  • Gateway.events (cognitive 26) scripts/remote/gateway_client.py:61 — Gateway.events has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), error handling 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Screen._pump (cognitive 26) · ×1
  • Screen._pump (cognitive 26) scripts/repro_slash_flicker.py:171 — Screen._pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (9 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · structured.firstJsonContainer (cognitive 26) · ×1
  • structured.firstJsonContainer (cognitive 26) sdk/typescript/src/structured.ts:181 — structured.firstJsonContainer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiscoverToolsTool · ×1
  • DiscoverToolsTool::execute (cognitive 25) crates/jcode-app-core/src/tool/discover.rs:527 — DiscoverToolsTool::execute has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 9 (13 pts), if/else 8 (12 pts) (nesting depth added 8). 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 · Walk · ×1
  • Walk::node (cognitive 25) crates/jcode-applet-types/src/validate.rs:213 — Walk::node has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (7 pts), boolean chains 2, 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 · NariSession · ×1
  • NariSession::run_inner (cognitive 25) crates/jcode-voice/src/nari.rs:400 — NariSession::run_inner has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_browser_handoff.summarize (cognitive 25) · ×1
  • benchmark_browser_handoff.summarize (cognitive 25) scripts/benchmark_browser_handoff.py:390 — benchmark_browser_handoff.summarize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6 (9 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_discovery_rate.main (cognitive 25) · ×1
  • benchmark_discovery_rate.main (cognitive 25) scripts/benchmark_discovery_rate.py:674 — benchmark_discovery_rate.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (9 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tb_compare.main (cognitive 25) · ×1
  • tb_compare.main (cognitive 25) scripts/tb_compare.py:53 — tb_compare.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 5 (9 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update_rehearsal.main (cognitive 25) · ×1
  • update_rehearsal.main (cognitive 25) scripts/update_rehearsal.py:449 — update_rehearsal.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, boolean chains 4, error handling 2 (3 pts), loops 2, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · insertTodoSessionDetails (cognitive 25) · ×1
  • insertTodoSessionDetails (cognitive 25) telemetry-worker/src/worker.js:1975 — insertTodoSessionDetails has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, other 10, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · jcode_provider_gemini · ×1
  • jcode_provider_gemini::build_contents_with_signature_policy (cognitive 24) crates/jcode-provider-gemini/src/lib.rs:287 — jcode_provider_gemini::build_contents_with_signature_policy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_runtime_memory_log.collect_session_peaks (cognitive 24) · ×1
  • analyze_runtime_memory_log.collect_session_peaks (cognitive 24) scripts/analyze_runtime_memory_log.py:437 — analyze_runtime_memory_log.collect_session_peaks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 10, 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 · apply_release_recovery.apply (cognitive 24) · ×1
  • apply_release_recovery.apply (cognitive 24) scripts/apply_release_recovery.py:24 — apply_release_recovery.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bench_headless_memory.run_jcode (cognitive 24) · ×1
  • bench_headless_memory.run_jcode (cognitive 24) scripts/bench_headless_memory.py:82 — bench_headless_memory.run_jcode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 5 (7 pts), ternaries 4 (5 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · jcode_monitor.render_dashboard (cognitive 24) · ×1
  • jcode_monitor.render_dashboard (cognitive 24) scripts/jcode_monitor.py:140 — jcode_monitor.render_dashboard has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11, loops 4 (8 pts), ternaries 2 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · measure_animation_cpu_cost.main (cognitive 24) · ×1
  • measure_animation_cpu_cost.main (cognitive 24) scripts/measure_animation_cpu_cost.py:138 — measure_animation_cpu_cost.main has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RelayClient · ×1
  • RelayClient::run_from_after (cognitive 23) crates/jcode-app-core/src/server/jade_relay.rs:243 — RelayClient::run_from_after has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 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.
D2 · Cognitive Complexity · AppletTool · ×1
  • AppletTool::execute (cognitive 23) crates/jcode-app-core/src/tool/applet.rs:228 — AppletTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 7 (10 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 · CalendarTool · ×1
  • CalendarTool::execute (cognitive 23) crates/jcode-app-core/src/tool/calendar.rs:317 — CalendarTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (8 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 · McpConfig · ×1
  • McpConfig::load_for_dir (cognitive 23) crates/jcode-base/src/mcp/protocol.rs:716 — McpConfig::load_for_dir has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptState · ×1
  • TranscriptState::apply (cognitive 23) crates/jcode-voice/src/nari.rs:535 — TranscriptState::apply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_browser_handoff.self_test (cognitive 23) · ×1
  • benchmark_browser_handoff.self_test (cognitive 23) scripts/benchmark_browser_handoff.py:436 — benchmark_browser_handoff.self_test has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 4 (5 pts), boolean chains 4, error handling 1 (4 pts), ternaries 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 · dump_fresh_spawn_screen.main (cognitive 23) · ×1
  • dump_fresh_spawn_screen.main (cognitive 23) scripts/dump_fresh_spawn_screen.py:30 — dump_fresh_spawn_screen.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5 (7 pts), error handling 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_harbor_claude_agent._load_key_from_env_file (cognitive 23) · ×1
  • jcode_harbor_claude_agent._load_key_from_env_file (cognitive 23) scripts/jcode_harbor_claude_agent.py:58 — jcode_harbor_claude_agent._load_key_from_env_file has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_monitor.main (cognitive 23) · ×1
  • jcode_monitor.main (cognitive 23) scripts/jcode_monitor.py:281 — jcode_monitor.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 3 (6 pts), loops 2 (4 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 · measure_key_echo.main (cognitive 23) · ×1
  • measure_key_echo.main (cognitive 23) scripts/measure_key_echo.py:18 — measure_key_echo.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), ternaries 3 (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 · Connection.runLoop (cognitive 23) · ×1
  • Connection.runLoop (cognitive 23) ios/Sources/JCodeKit/Connection.swift:121 — Connection.runLoop has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Connection.receiveLoop (cognitive 23) · ×1
  • Connection.receiveLoop (cognitive 23) ios/Sources/JCodeKit/Connection.swift:182 — Connection.receiveLoop has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (5 pts), match/switch 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker.isMeaningfulLifecycleEvent (cognitive 23) · ×1
  • worker.isMeaningfulLifecycleEvent (cognitive 23) telemetry-worker/src/worker.js:1711 — worker.isMeaningfulLifecycleEvent has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 20, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ReadTool · ×1
  • ReadTool::execute (cognitive 22) crates/jcode-app-core/src/tool/read.rs:150 — ReadTool::execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · jcode_provider_antigravity · ×1
  • jcode_provider_antigravity::flatten_schema_combiners (cognitive 22) crates/jcode-provider-antigravity/src/lib.rs:627 — jcode_provider_antigravity::flatten_schema_combiners has cognitive complexity 22 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Registration · ×1
  • Registration::capture (cognitive 22) crates/jcode-voice/src/global/hotkey.rs:215 — Registration::capture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 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.
D2 · Cognitive Complexity · analyze_runtime_memory_log.build_coverage_report (cognitive 22) · ×1
  • analyze_runtime_memory_log.build_coverage_report (cognitive 22) scripts/analyze_runtime_memory_log.py:476 — analyze_runtime_memory_log.build_coverage_report has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), boolean chains 5, 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 · benchmark_swarm.print_comparison (cognitive 22) · ×1
  • benchmark_swarm.print_comparison (cognitive 22) scripts/benchmark_swarm.py:454 — benchmark_swarm.print_comparison has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (7 pts), loops 3 (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 · check_dependency_boundaries.main (cognitive 22) · ×1
  • check_dependency_boundaries.main (cognitive 22) scripts/check_dependency_boundaries.py:68 — check_dependency_boundaries.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_module_files.main (cognitive 22) · ×1
  • check_module_files.main (cognitive 22) scripts/check_module_files.py:82 — check_module_files.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_panic_budget.production_lines (cognitive 22) · ×1
  • check_panic_budget.production_lines (cognitive 22) scripts/check_panic_budget.py:79 — check_panic_budget.production_lines has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch 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_swallowed_error_budget.production_lines (cognitive 22) · ×1
  • check_swallowed_error_budget.production_lines (cognitive 22) scripts/check_swallowed_error_budget.py:80 — check_swallowed_error_budget.production_lines has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compile_isolation_report.target_state_violations (cognitive 22) · ×1
  • compile_isolation_report.target_state_violations (cognitive 22) scripts/compile_isolation_report.py:137 — compile_isolation_report.target_state_violations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wake-lambda.handler (cognitive 22) · ×1
  • wake-lambda.handler (cognitive 22) scripts/phone-server/wake-lambda.py:156 — wake-lambda.handler has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repro_input_flicker.observe_keystroke (cognitive 22) · ×1
  • repro_input_flicker.observe_keystroke (cognitive 22) scripts/repro_input_flicker.py:388 — repro_input_flicker.observe_keystroke has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4 (5 pts), error handling 2 (4 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 · repro_startup_lag.main (cognitive 22) · ×1
  • repro_startup_lag.main (cognitive 22) scripts/repro_startup_lag.py:72 — repro_startup_lag.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, 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 · McpManager · ×1
  • McpManager::connect_all (cognitive 21) crates/jcode-base/src/mcp/manager.rs:183 — McpManager::connect_all has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SseParser · ×1
  • SseParser::push (cognitive 21) crates/jcode-base/src/mcp/remote.rs:977 — SseParser::push has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 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.
D2 · Cognitive Complexity · jcode_notify_email · ×1
  • jcode_notify_email::poll_imap_once (cognitive 21) crates/jcode-notify-email/src/lib.rs:65 — jcode_notify_email::poll_imap_once has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnthropicProvider · ×1
  • AnthropicProvider::get_oauth_access_token (cognitive 21) crates/jcode-provider-anthropic-runtime/src/lib.rs:1058 — AnthropicProvider::get_oauth_access_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SharedSshTransport · ×1
  • SharedSshTransport::connect_with (cognitive 21) crates/jcode-sdk/src/ssh.rs:420 — SharedSshTransport::connect_with has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), match/switch 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 · StreamBuffer · ×1
  • StreamBuffer::drain_ops (cognitive 21) crates/jcode-tui-core/src/stream_buffer.rs:303 — StreamBuffer::drain_ops has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (5 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 · analyze_runtime_memory_log.build_client_hints (cognitive 21) · ×1
  • analyze_runtime_memory_log.build_client_hints (cognitive 21) scripts/analyze_runtime_memory_log.py:922 — analyze_runtime_memory_log.build_client_hints has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · bench_headless_memory.run_opencode (cognitive 21) · ×1
  • bench_headless_memory.run_opencode (cognitive 21) scripts/bench_headless_memory.py:510 — bench_headless_memory.run_opencode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 4 (6 pts), boolean chains 3, error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_discovery.main (cognitive 21) · ×1
  • benchmark_discovery.main (cognitive 21) scripts/benchmark_discovery.py:741 — benchmark_discovery.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 4 (5 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 · benchmark_takehome.run_swarm (cognitive 21) · ×1
  • benchmark_takehome.run_swarm (cognitive 21) scripts/benchmark_takehome.py:231 — benchmark_takehome.run_swarm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (7 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 · H.do_POST (cognitive 21) · ×1
  • H.do_POST (cognitive 21) scripts/fake_openai_server.py:42 — H.do_POST has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (6 pts), boolean chains 4, 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 · profile_idle_donut.main (cognitive 21) · ×1
  • profile_idle_donut.main (cognitive 21) scripts/profile_idle_donut.py:48 — profile_idle_donut.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 6, error handling 2 (4 pts), loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ProcessMonitor.finalize (cognitive 21) · ×1
  • ProcessMonitor.finalize (cognitive 21) scripts/profile_spawn.py:231 — ProcessMonitor.finalize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 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 · remote_check.main (cognitive 21) · ×1
  • remote_check.main (cognitive 21) scripts/remote/remote_check.py:42 — remote_check.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3, ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_terminal_bench_campaign.main (cognitive 21) · ×1
  • run_terminal_bench_campaign.main (cognitive 21) scripts/run_terminal_bench_campaign.py:416 — run_terminal_bench_campaign.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3 (4 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownText.segments (cognitive 21) · ×1
  • MarkdownText.segments (cognitive 21) ios/Sources/JCodeMobile/MarkdownText.swift:39 — MarkdownText.segments has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 1 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildPriceIndex (cognitive 21) · ×1
  • buildPriceIndex (cognitive 21) telemetry-worker/src/model-pricing.js:122 — buildPriceIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), loops 3 (4 pts), other 2, boolean chains 1 (nesting depth added 10). Of this number, 13 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 · normalizeDiscoveryEvent (cognitive 21) · ×1
  • normalizeDiscoveryEvent (cognitive 21) telemetry-worker/src/worker.js:2203 — normalizeDiscoveryEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RelayLauncherClient · ×1
  • RelayLauncherClient::run (cognitive 20) crates/jcode-app-core/src/server/jade_relay.rs:605 — RelayLauncherClient::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 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 · McpCallTool · ×1
  • McpCallTool::execute (cognitive 20) crates/jcode-app-core/src/tool/mcp.rs:366 — McpCallTool::execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GlobalEventStream · ×1
  • GlobalEventStream::next (cognitive 20) crates/jcode-sdk/src/client.rs:230 — GlobalEventStream::next has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnchorStabilityRecorder · ×1
  • AnchorStabilityRecorder::observe (cognitive 20) crates/jcode-tui-core/src/anchor_stability.rs:212 — AnchorStabilityRecorder::observe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · analyze_runtime_memory_log.resolve_paths (cognitive 20) · ×1
  • analyze_runtime_memory_log.resolve_paths (cognitive 20) scripts/analyze_runtime_memory_log.py:163 — analyze_runtime_memory_log.resolve_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_runtime_memory_log.load_samples (cognitive 20) · ×1
  • analyze_runtime_memory_log.load_samples (cognitive 20) scripts/analyze_runtime_memory_log.py:201 — analyze_runtime_memory_log.load_samples has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 2 (6 pts), error handling 2 (5 pts), boolean chains 3, if/else 1 (3 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_swallowed_error_budget.main (cognitive 20) · ×1
  • check_swallowed_error_budget.main (cognitive 20) scripts/check_swallowed_error_budget.py:182 — check_swallowed_error_budget.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5 (7 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CloudTUI.close (cognitive 20) · ×1
  • CloudTUI.close (cognitive 20) scripts/cloud_acceptance_tui.py:331 — CloudTUI.close has cognitive complexity 20 (threshold 15). Drivers by points: error handling 5 (10 pts), loops 6 (8 pts), boolean chains 1, if/else 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 · JcodeHarborAgent.run (cognitive 20) · ×1
  • JcodeHarborAgent.run (cognitive 20) scripts/jcode_harbor_agent.py:233 — JcodeHarborAgent.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, error handling 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_memory_snapshot.classify_process (cognitive 20) · ×1
  • jcode_memory_snapshot.classify_process (cognitive 20) scripts/jcode_memory_snapshot.py:113 — jcode_memory_snapshot.classify_process has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · tb_compare.collect_results (cognitive 20) · ×1
  • tb_compare.collect_results (cognitive 20) scripts/tb_compare.py:29 — tb_compare.collect_results has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), error handling 2 (6 pts), boolean chains 4 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · writeFirehose (cognitive 20) · ×1
  • writeFirehose (cognitive 20) telemetry-worker/src/worker.js:369 — writeFirehose has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 2, error handling 1, other 1. Of this number, 14 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · jcode_memory_types · ×1
  • jcode_memory_types::format_entries_for_prompt_with_header (cognitive 19) crates/jcode-memory-types/src/lib.rs:664 — jcode_memory_types::format_entries_for_prompt_with_header has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5, match/switch 2 (5 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · jcode_message_types · ×1
  • jcode_message_types::ends_with_fresh_user_turn (cognitive 19) crates/jcode-message-types/src/lib.rs:484 — jcode_message_types::ends_with_fresh_user_turn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EndpointInfo · ×1
  • EndpointInfo::detail_string (cognitive 19) crates/jcode-provider-openrouter/src/lib.rs:134 — EndpointInfo::detail_string has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SyncPipeOperation · ×1
  • SyncPipeOperation::complete (cognitive 19) crates/jcode-transport/src/windows.rs:474 — SyncPipeOperation::complete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_env · ×1
  • jcode_provider_env::load_api_key_from_env_or_config (cognitive 19) crates/jcode-provider-env/src/lib.rs:85 — jcode_provider_env::load_api_key_from_env_or_config 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 · diagnose_idle_render_cost.main (cognitive 19) · ×1
  • diagnose_idle_render_cost.main (cognitive 19) scripts/diagnose_idle_render_cost.py:313 — diagnose_idle_render_cost.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 2 (4 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · profile_remote_resume_burst.create_session (cognitive 19) · ×1
  • profile_remote_resume_burst.create_session (cognitive 19) scripts/profile_remote_resume_burst.py:92 — profile_remote_resume_burst.create_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 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 · profile_single_spawn.create_session (cognitive 19) · ×1
  • profile_single_spawn.create_session (cognitive 19) scripts/profile_single_spawn.py:42 — profile_single_spawn.create_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 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 · JcodeClient.ingest (cognitive 19) · ×1
  • JcodeClient.ingest (cognitive 19) sdk/typescript/src/client.ts:343 — JcodeClient.ingest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · move-bulk-events.q (cognitive 19) · ×1
  • move-bulk-events.q (cognitive 19) telemetry-worker/scripts/move-bulk-events.mjs:32 — move-bulk-events.q has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BuildRequest · ×1
  • BuildRequest::reconcile_pending_state (cognitive 18) crates/jcode-app-core/src/tool/selfdev/mod.rs:373 — BuildRequest::reconcile_pending_state 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 · WebFetchTool · ×1
  • WebFetchTool::execute (cognitive 18) crates/jcode-app-core/src/tool/webfetch.rs:74 — WebFetchTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1, 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 · Embedder · ×1
  • Embedder::embed (cognitive 18) crates/jcode-embedding/src/lib.rs:172 — Embedder::embed has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · UsageOverlay · ×1
  • UsageOverlay::render_item_list (cognitive 18) crates/jcode-tui-usage-overlay/src/lib.rs:507 — UsageOverlay::render_item_list has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_terminal_prompt · ×1
  • jcode_terminal_prompt::secret::read_secret_line (cognitive 18) crates/jcode-terminal-prompt/src/secret.rs:27 — jcode_terminal_prompt::secret::read_secret_line has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analyze_openai_ws_cache.main (cognitive 18) · ×1
  • analyze_openai_ws_cache.main (cognitive 18) scripts/analyze_openai_ws_cache.py:139 — analyze_openai_ws_cache.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 5 (7 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bench_headless_memory.debug_cmd (cognitive 18) · ×1
  • bench_headless_memory.debug_cmd (cognitive 18) scripts/bench_headless_memory.py:52 — bench_headless_memory.debug_cmd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 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 · check_donut_animates_live.main (cognitive 18) · ×1
  • check_donut_animates_live.main (cognitive 18) scripts/check_donut_animates_live.py:68 — check_donut_animates_live.main has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (5 pts), ternaries 3 (5 pts), if/else 4, boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · jcode_harbor_claude_agent._load_openrouter_key (cognitive 18) · ×1
  • jcode_harbor_claude_agent._load_openrouter_key (cognitive 18) scripts/jcode_harbor_claude_agent.py:90 — jcode_harbor_claude_agent._load_openrouter_key has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_terminal_bench_campaign.finalize_task_result (cognitive 18) · ×1
  • run_terminal_bench_campaign.finalize_task_result (cognitive 18) scripts/run_terminal_bench_campaign.py:318 — run_terminal_bench_campaign.finalize_task_result has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · insertWebDetails (cognitive 18) · ×1
  • insertWebDetails (cognitive 18) telemetry-worker/src/worker.js:2011 — insertWebDetails has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 2, other 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 · WriteTool · ×1
  • WriteTool::execute (cognitive 17) crates/jcode-app-core/src/tool/write.rs:57 — WriteTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 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 · McpTool · ×1
  • McpTool::execute (cognitive 17) crates/jcode-base/src/mcp/tool.rs:53 — McpTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ServerRegistry · ×1
  • ServerRegistry::cleanup_stale (cognitive 17) crates/jcode-base/src/registry.rs:125 — ServerRegistry::cleanup_stale has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_session_types · ×1
  • jcode_session_types::format_session_search_results (cognitive 17) crates/jcode-session-types/src/lib.rs:754 — jcode_session_types::format_session_search_results has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnchoredInlineImages · ×1
  • AnchoredInlineImages::unplaced_items (cognitive 17) crates/jcode-tui/src/tui/ui_inline_image.rs:728 — AnchoredInlineImages::unplaced_items has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_usage_types · ×1
  • jcode_usage_types::sanitize_telemetry_label (cognitive 17) crates/jcode-usage-types/src/lib.rs:834 — jcode_usage_types::sanitize_telemetry_label has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Chunker · ×1
  • Chunker::push (cognitive 17) crates/jcode-voice/src/streaming_capture.rs:174 — Chunker::push has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compile_isolation_report.collect_stats (cognitive 17) · ×1
  • compile_isolation_report.collect_stats (cognitive 17) scripts/compile_isolation_report.py:82 — compile_isolation_report.collect_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (4 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · measure_animation_cpu_cost.run_once (cognitive 17) · ×1
  • measure_animation_cpu_cost.run_once (cognitive 17) scripts/measure_animation_cpu_cost.py:63 — measure_animation_cpu_cost.run_once has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · profile_spawn.sample_proc (cognitive 17) · ×1
  • profile_spawn.sample_proc (cognitive 17) scripts/profile_spawn.py:112 — profile_spawn.sample_proc has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 4, error handling 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.
D2 · Cognitive Complexity · repro_expand_edit_shortcut.main (cognitive 17) · ×1
  • repro_expand_edit_shortcut.main (cognitive 17) scripts/repro_expand_edit_shortcut.py:428 — repro_expand_edit_shortcut.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 3 (4 pts), loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · repro_slash_flicker.watch_menu (cognitive 17) · ×1
  • repro_slash_flicker.watch_menu (cognitive 17) scripts/repro_slash_flicker.py:275 — repro_slash_flicker.watch_menu has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verify_discovery_select.main (cognitive 17) · ×1
  • verify_discovery_select.main (cognitive 17) scripts/verify_discovery_select.py:103 — verify_discovery_select.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CompactionManager · ×1
  • CompactionManager::ensure_context_fits (cognitive 16) crates/jcode-base/src/compaction.rs:959 — CompactionManager::ensure_context_fits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_build_support · ×1
  • jcode_build_support::version_gc::prune_old_versions_in (cognitive 16) crates/jcode-build-support/src/version_gc.rs:165 — jcode_build_support::version_gc::prune_old_versions_in has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Companion · ×1
  • Companion::handle (cognitive 16) crates/jcode-companion/src/server.rs:66 — Companion::handle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 4 (7 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 · AuthRetryStream · ×1
  • AuthRetryStream::poll_next (cognitive 16) crates/jcode-provider-grok-build-runtime/src/lib.rs:122 — AuthRetryStream::poll_next has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr · ×1
  • Expr::layout (cognitive 16) crates/jcode-render-core/src/math.rs:107 — Expr::layout has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ResolvedTokenPricing · ×1
  • ResolvedTokenPricing::cost_for_usage (cognitive 16) crates/jcode-tui/src/tui/app/misc_ui.rs:33 — ResolvedTokenPricing::cost_for_usage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteConnection · ×1
  • RemoteConnection::next_event (cognitive 16) crates/jcode-tui/src/tui/backend.rs:1301 — RemoteConnection::next_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (5 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 · Snapshot · ×1
  • Snapshot::row (cognitive 16) crates/jcode-tui/src/tui/justrust_status.rs:158 — Snapshot::row has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, 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 · Poller · ×1
  • Poller::refresh (cognitive 16) crates/jcode-tui/src/tui/justrust_status.rs:288 — Poller::refresh has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, 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 · bench_startup.main (cognitive 16) · ×1
  • bench_startup.main (cognitive 16) scripts/bench_startup.py:292 — bench_startup.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 5 (7 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_discovery_rate.summarize_case (cognitive 16) · ×1
  • benchmark_discovery_rate.summarize_case (cognitive 16) scripts/benchmark_discovery_rate.py:563 — benchmark_discovery_rate.summarize_case has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · probe_idle_state.main (cognitive 16) · ×1
  • probe_idle_state.main (cognitive 16) scripts/probe_idle_state.py:93 — probe_idle_state.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, error handling 2 (4 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · profile_spawn.find_child_server (cognitive 16) · ×1
  • profile_spawn.find_child_server (cognitive 16) scripts/profile_spawn.py:297 — profile_spawn.find_child_server has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repro_idle_session_rss.main (cognitive 16) · ×1
  • repro_idle_session_rss.main (cognitive 16) scripts/repro_idle_session_rss.py:93 — repro_idle_session_rss.main has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (5 pts), error handling 2 (4 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sweep_animation_fps.run (cognitive 16) · ×1
  • sweep_animation_fps.run (cognitive 16) scripts/sweep_animation_fps.py:49 — sweep_animation_fps.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · verify_public_release.verify_downloads (cognitive 16) · ×1
  • verify_public_release.verify_downloads (cognitive 16) scripts/verify_public_release.py:44 — verify_public_release.verify_downloads has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · why_no_animation_area.main (cognitive 16) · ×1
  • why_no_animation_area.main (cognitive 16) scripts/why_no_animation_area.py:33 — why_no_animation_area.main has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (5 pts), boolean chains 3, if/else 3, ternaries 2 (3 pts), loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker.validateTranscript (cognitive 16) · ×1
  • worker.validateTranscript (cognitive 16) telemetry-worker/src/worker.js:857 — worker.validateTranscript 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 · worker.normalizeInstallFunnelEvent (cognitive 16) · ×1
  • worker.normalizeInstallFunnelEvent (cognitive 16) telemetry-worker/src/worker.js:2147 — worker.normalizeInstallFunnelEvent 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 · syncModelPrices (cognitive 16) · ×1
  • syncModelPrices (cognitive 16) telemetry-worker/src/model-pricing.js:320 — syncModelPrices has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts), loops 2, other 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 · scheduled (cognitive 16) · ×1
  • scheduled (cognitive 16) telemetry-worker/src/worker.js:692 — scheduled has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 4, error handling 4, loops 2 (nesting depth added 2). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 694). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium CVE · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (8 members, 35 shared lines) · ×1
  • Near-duplicate member family (8 members, 35 shared lines) scripts/check_donut_animates_live.py:69 — scripts/check_donut_animates_live.py:69-176 | scripts/count_idle_draws.py:46-165 | scripts/dump_fresh_spawn_screen.py:31-127 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/verify_donut_still_animates.py:69-245 | scripts/which_overlay_blocks_donut.py:43-118 | scripts/why_no_animation_area.py:34-133 — These 8 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 14 shared lines) · ×1
  • Near-duplicate member family (7 members, 14 shared lines) scripts/check_donut_animates_live.py:69 — scripts/check_donut_animates_live.py:69-176 | scripts/count_idle_draws.py:46-165 | scripts/diagnose_idle_render_cost.py:314-443 | scripts/dump_fresh_spawn_screen.py:31-127 | scripts/probe_idle_state.py:94-206 | scripts/repro_slash_flicker.py:341-495 | scripts/verify_donut_still_animates.py:69-245 — These 7 members are variants of one another: a block of 14 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 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 28 shared lines) · ×1
  • Near-duplicate member family (6 members, 28 shared lines) scripts/count_idle_draws.py:46 — scripts/count_idle_draws.py:46-165 | scripts/diagnose_idle_render_cost.py:314-443 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/which_overlay_blocks_donut.py:43-118 | scripts/why_no_animation_area.py:34-133 — These 6 members are variants of one another: a block of 28 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 24 shared lines) · ×1
  • Near-duplicate member family (5 members, 24 shared lines) scripts/count_idle_draws.py:46 — scripts/count_idle_draws.py:46-165 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/profile_idle_donut.py:49-157 | scripts/which_overlay_blocks_donut.py:43-118 — These 5 members are variants of one another: a block of 24 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 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 · Near-duplicate member family (3 members, 28 shared lines) · ×1
  • Near-duplicate member family (3 members, 28 shared lines) crates/jcode-app-core/src/tool/discover.rs:991 — crates/jcode-app-core/src/tool/discover.rs:991-1062 | crates/jcode-app-core/src/tool/discover.rs:1180-1256 | crates/jcode-app-core/src/tool/discover.rs:1261-1350 — These 3 members are variants of one another: a block of 28 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (844 shared lines) · ×1
  • Near-duplicate member pair (844 shared lines) crates/jcode-tui-markdown/src/markdown_render_full.rs:20 — crates/jcode-tui-markdown/src/markdown_render_full.rs:20-1080 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:7-969 — These two members are variants of one another: 844 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 (95 shared lines) · ×1
  • Near-duplicate member pair (95 shared lines) crates/jcode-provider-anthropic-runtime/src/lib.rs:1326 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1326-1428 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1786-1887 — These two members are variants of one another: 95 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 (89 shared lines) · ×1
  • Near-duplicate member pair (89 shared lines) crates/jcode-tui-mermaid/src/mermaid_widget.rs:87 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:87-311 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:341-548 — These two members are variants of one another: 89 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 (88 shared lines) · ×1
  • Near-duplicate member pair (88 shared lines) crates/jcode-render-core/src/preprocess.rs:773 — crates/jcode-render-core/src/preprocess.rs:773-920 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3-126 — These two members are variants of one another: 88 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 (52 shared lines) · ×1
  • Near-duplicate member pair (52 shared lines) scripts/repro_input_flicker.py:465 — scripts/repro_input_flicker.py:465-688 | scripts/repro_input_lag.py:437-667 — These two members are variants of one another: 52 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (50 shared lines) · ×1
  • Near-duplicate member pair (50 shared lines) crates/jcode-tui/src/tui/ui_prepare.rs:2458 — crates/jcode-tui/src/tui/ui_prepare.rs:2458-2551 | crates/jcode-tui/src/tui/ui_prepare.rs:2568-2732 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (48 shared lines) · ×1
  • Near-duplicate member pair (48 shared lines) crates/jcode-base/src/provider/dispatch.rs:64 — crates/jcode-base/src/provider/dispatch.rs:64-181 | crates/jcode-base/src/provider/dispatch.rs:191-356 — These two members are variants of one another: 48 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/jcode-tui/src/tui/login_picker.rs:679 — crates/jcode-tui/src/tui/login_picker.rs:679-752 | crates/jcode-tui/src/tui/login_picker.rs:754-827 — 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 (46 shared lines) · ×1
  • Near-duplicate member pair (46 shared lines) crates/jcode-base/src/auth/oauth.rs:218 — crates/jcode-base/src/auth/oauth.rs:218-308 | crates/jcode-base/src/auth/oauth.rs:325-431 — These two members are variants of one another: 46 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 (41 shared lines) · ×1
  • Near-duplicate member pair (41 shared lines) scripts/measure_animation_cpu_cost.py:65 — scripts/measure_animation_cpu_cost.py:65-135 | scripts/sweep_animation_fps.py:51-124 — These two members are variants of one another: 41 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 (39 shared lines) · ×1
  • Near-duplicate member pair (39 shared lines) crates/jcode-tui/src/tui/app/remote/reconnect.rs:270 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:270-371 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:483-705 — These two members are variants of one another: 39 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 (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) crates/jcode-app-core/src/channel.rs:198 — crates/jcode-app-core/src/channel.rs:198-280 | crates/jcode-app-core/src/channel.rs:397-489 — These two members are variants of one another: 36 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 (31 shared lines) · ×1
  • Near-duplicate member pair (31 shared lines) crates/jcode-base/src/prompt.rs:977 — crates/jcode-base/src/prompt.rs:977-1019 | crates/jcode-base/src/prompt.rs:1022-1065 — These two members are variants of one another: 31 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 (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) crates/jcode-tui-style/src/color.rs:311 — crates/jcode-tui-style/src/color.rs:311-337 | crates/jcode-tui-workspace/src/color_support.rs:273-299 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×1
  • Edited copy of a member (35 corresponding lines) crates/jcode-tui-core/src/keybind.rs:65 — crates/jcode-tui-core/src/keybind.rs:65-99 | crates/jcode-tui/src/tui/keybind.rs:588-625 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) crates/jcode-app-core/src/usage_display.rs:32 — crates/jcode-app-core/src/usage_display.rs:32-65 | crates/jcode-base/src/usage/display.rs:32-69 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) crates/jcode-tui-account-picker/src/overlay.rs:458 — crates/jcode-tui-account-picker/src/overlay.rs:458-496 | crates/jcode-tui-account-picker/src/overlay.rs:498-577 | crates/jcode-tui-account-picker/src/overlay.rs:579-771 | crates/jcode-tui-usage-overlay/src/lib.rs:440-505 | crates/jcode-tui-usage-overlay/src/lib.rs:507-588 | crates/jcode-tui-usage-overlay/src/lib.rs:590-638 | crates/jcode-tui/src/tui/login_picker.rs:346-402 | crates/jcode-tui/src/tui/login_picker.rs:404-470 | crates/jcode-tui/src/tui/login_picker.rs:472-593 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:78 — scripts/diagnose_idle_render_cost.py:78-90 | scripts/profile_remote_resume_burst.py:77-89 | scripts/profile_single_spawn.py:27-39 | scripts/repro_expand_edit_shortcut.py:144-156 | scripts/repro_input_flicker.py:89-101 | scripts/repro_input_lag.py:91-103 | scripts/repro_live_duplicate.py:114-126 | scripts/repro_slash_flicker.py:85-97 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/jcode-provider-doctor/src/live_provider_probes.rs:766 — crates/jcode-provider-doctor/src/live_provider_probes.rs:766-814 | crates/jcode-provider-doctor/src/live_provider_probes.rs:823-912 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1094-1142 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1151-1232 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1286-1333 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1344-1424 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1447-1528 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Duplicated block (246 lines × 2) · ×1
  • Duplicated block (246 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:150 — crates/jcode-tui-markdown/src/markdown_render_full.rs:150-395 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:121-366 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 (169–174 lines × 2) · ×1
  • Duplicated block (169–174 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:496 — crates/jcode-tui-markdown/src/markdown_render_full.rs:496-669 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:469-637 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 (165 lines × 2) · ×1
  • Duplicated block (165 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:673 — crates/jcode-tui-markdown/src/markdown_render_full.rs:673-837 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:641-805 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 (92 lines × 2) · ×1
  • Duplicated block (92 lines × 2) crates/jcode-app-core/src/usage_openai.rs:317 — crates/jcode-app-core/src/usage_openai.rs:317-408 | crates/jcode-base/src/usage/openai_helpers.rs:339-430 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (88–89 lines × 2) · ×1
  • Duplicated block (88–89 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:894 — crates/jcode-tui-markdown/src/markdown_render_full.rs:894-982 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:858-945 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 (75 lines × 2) · ×1
  • Duplicated block (75 lines × 2) crates/jcode-app-core/src/session_launch.rs:442 — crates/jcode-app-core/src/session_launch.rs:442-516 | crates/jcode-app-core/src/session_launch.rs:567-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (67 lines × 2) · ×1
  • Duplicated block (67 lines × 2) src/cli/commands.rs:3243 — src/cli/commands.rs:3243-3309 | src/cli/commands.rs:3360-3426 — both copies are in the same file, so extract the 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 (52–53 lines × 2) · ×1
  • Duplicated block (52–53 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:839 — crates/jcode-tui-markdown/src/markdown_render_full.rs:839-891 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:806-857 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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–52 lines × 2) · ×1
  • Duplicated block (51–52 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:97 — crates/jcode-tui-markdown/src/markdown_render_full.rs:97-148 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:70-120 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 (49–51 lines × 2) · ×1
  • Duplicated block (49–51 lines × 2) src/cli/tui_launch.rs:643 — src/cli/tui_launch.rs:643-693 | src/cli/tui_launch.rs:698-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.
D4 · Code Duplication · Duplicated block (45–46 lines × 2) · ×1
  • Duplicated block (45–46 lines × 2) crates/jcode-provider-anthropic-runtime/src/lib.rs:1383 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1383-1428 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1843-1887 — both copies are in the same file, so extract the 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–41 lines × 3) · ×1
  • Duplicated block (39–41 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:403 — crates/jcode-tui-account-picker/src/overlay.rs:403-443 | crates/jcode-tui-usage-overlay/src/lib.rs:387-425 | crates/jcode-tui/src/tui/login_picker.rs:291-331 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1466 — crates/jcode-app-core/src/server/client_lifecycle.rs:1466-1506 | crates/jcode-app-core/src/server/client_lifecycle.rs:1527-1567 — both copies are in the same file, so extract the 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–41 lines × 2) · ×1
  • Duplicated block (37–41 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:826 — crates/jcode-provider-doctor/src/live_provider_probes.rs:826-866 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1154-1190 — both copies are in the same file, so extract the 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 lines × 2) · ×1
  • Duplicated block (40 lines × 2) crates/jcode-tui-style/src/color.rs:95 — crates/jcode-tui-style/src/color.rs:95-134 | crates/jcode-tui-workspace/src/color_support.rs:64-103 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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 (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) crates/jcode-tui/src/tui/session_picker.rs:385 — crates/jcode-tui/src/tui/session_picker.rs:385-423 | crates/jcode-tui/src/tui/session_picker.rs:515-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.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) crates/jcode-app-core/src/server/client_comm_channels.rs:164 — crates/jcode-app-core/src/server/client_comm_channels.rs:164-199 | crates/jcode-app-core/src/server/client_comm_channels.rs:249-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32–36 lines × 2) · ×1
  • Duplicated block (32–36 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:127 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:127-162 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:381-412 — both copies are in the same file, so extract the 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 × 3) · ×1
  • Duplicated block (32 lines × 3) crates/jcode-telemetry-core/src/lib.rs:1635 — crates/jcode-telemetry-core/src/lib.rs:1635-1666 | crates/jcode-telemetry-core/src/lifecycle.rs:51-82 | crates/jcode-telemetry-core/src/lifecycle.rs:233-264 — 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.
D4 · Code Duplication · Duplicated block (19–30 lines × 2) · ×1
  • Duplicated block (19–30 lines × 2) crates/jcode-app-core/src/usage_openai.rs:109 — crates/jcode-app-core/src/usage_openai.rs:109-127 | crates/jcode-base/src/usage/openai_helpers.rs:112-141 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (28–29 lines × 4) · ×1
  • Duplicated block (28–29 lines × 4) crates/jcode-base/src/embedding_stub.rs:50 — crates/jcode-base/src/embedding_stub.rs:50-77 | crates/jcode-embedding/src/lib.rs:49-76 | crates/jcode-memory-types/src/graph.rs:52-79 | crates/jcode-memory-types/src/lib.rs:874-902 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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 lines × 3) · ×1
  • Duplicated block (27 lines × 3) crates/jcode-tui/src/tui/app/commands.rs:302 — crates/jcode-tui/src/tui/app/commands.rs:302-328 | crates/jcode-tui/src/tui/app/commands_improve.rs:403-429 | crates/jcode-tui/src/tui/app/commands_overnight.rs:81-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) crates/jcode-app-core/src/usage_openai.rs:81 — crates/jcode-app-core/src/usage_openai.rs:81-106 | crates/jcode-base/src/usage/openai_helpers.rs:87-113 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 346 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 (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:384 — crates/jcode-tui/src/tui/app/remote.rs:384-410 | crates/jcode-tui/src/tui/app/remote.rs:1685-1709 — both copies are in the same file, so extract the 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/jcode-app-core/src/tool/apply_patch.rs:432 — crates/jcode-app-core/src/tool/apply_patch.rs:432-457 | crates/jcode-app-core/src/tool/edit.rs:351-376 | crates/jcode-app-core/src/tool/write.rs:213-238 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (22–26 lines × 3) · ×1
  • Duplicated block (22–26 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:826 — crates/jcode-provider-doctor/src/live_provider_probes.rs:826-851 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1154-1175 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1346-1367 — 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 (4–26 lines × 3) · ×1
  • Duplicated block (4–26 lines × 3) crates/jcode-base/src/session/crash.rs:39 — crates/jcode-base/src/session/crash.rs:39-42 | crates/jcode-base/src/session/crash.rs:79-103 | crates/jcode-base/src/session/crash.rs:215-240 — 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 (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:2664 — crates/jcode-tui/src/tui/ui_messages.rs:2664-2687 | crates/jcode-tui/src/tui/ui_messages.rs:3556-3581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) crates/jcode-provider-bedrock/src/lib.rs:485 — crates/jcode-provider-bedrock/src/lib.rs:485-506 | crates/jcode-schema-dialect/src/dialect.rs:311-335 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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.
D4 · Code Duplication · Duplicated block (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:473 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:473-492 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:2380-2404 — both copies are in the same file, so extract the 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–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1629 — crates/jcode-app-core/src/server/client_session.rs:1629-1649 | crates/jcode-app-core/src/server/client_session.rs:2052-2075 — both copies are in the same file, so extract the 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–23 lines × 3) · ×1
  • Duplicated block (22–23 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:853 — crates/jcode-provider-doctor/src/live_provider_probes.rs:853-874 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1177-1198 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1368-1390 — 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 (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) crates/jcode-tui/src/tui/app/onboarding_graph.rs:211 — crates/jcode-tui/src/tui/app/onboarding_graph.rs:211-233 | crates/jcode-tui/src/tui/app/onboarding_graph.rs:249-269 — both copies are in the same file, so extract the 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 × 3) · ×1
  • Duplicated block (22 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:310 — crates/jcode-tui-account-picker/src/overlay.rs:310-331 | crates/jcode-tui-usage-overlay/src/lib.rs:334-355 | crates/jcode-tui/src/tui/login_picker.rs:205-226 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2057 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2057-2078 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2099-2117 — both copies are in the same file, so extract the 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–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) crates/jcode-tui-markdown/src/markdown_wrap.rs:275 — crates/jcode-tui-markdown/src/markdown_wrap.rs:275-296 | crates/jcode-tui-markdown/src/markdown_wrap.rs:398-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) crates/jcode-app-core/src/server/client_lifecycle.rs:1467 — crates/jcode-app-core/src/server/client_lifecycle.rs:1467-1493 | crates/jcode-app-core/src/server/client_lifecycle.rs:1529-1554 | crates/jcode-app-core/src/server/client_lifecycle.rs:1829-1849 — 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–21 lines × 3) · ×1
  • Duplicated block (17–21 lines × 3) crates/jcode-setup-hints/src/lib.rs:2392 — crates/jcode-setup-hints/src/lib.rs:2392-2408 | crates/jcode-tui-style/src/color.rs:61-81 | crates/jcode-tui-workspace/src/color_support.rs:32-50 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) crates/jcode-telemetry-core/src/lib.rs:1729 — crates/jcode-telemetry-core/src/lib.rs:1729-1749 | crates/jcode-telemetry-core/src/lib.rs:1766-1785 — both copies are in the same file, so extract the 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–21 lines × 2) · ×1
  • Duplicated block (10–21 lines × 2) crates/jcode-tui-anim/src/lib.rs:196 — crates/jcode-tui-anim/src/lib.rs:196-205 | crates/jcode-tui-anim/src/lib.rs:286-306 — both copies are in the same file, so extract the 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–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) crates/jcode-provider-core/src/transport.rs:60 — crates/jcode-provider-core/src/transport.rs:60-79 | scripts/repro/tls-bad-record-mac/src/main.rs:40-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) crates/jcode-telemetry-core/src/lib.rs:1668 — crates/jcode-telemetry-core/src/lib.rs:1668-1686 | crates/jcode-telemetry-core/src/lifecycle.rs:105-123 | crates/jcode-telemetry-core/src/lifecycle.rs:292-310 — 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.
D4 · Code Duplication · Duplicated block (18–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:235 — crates/jcode-tui/src/tui/app/turn.rs:235-252 | crates/jcode-tui/src/tui/app/turn.rs:553-571 | crates/jcode-tui/src/tui/app/turn.rs:1555-1573 — 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 (15–18 lines × 3) · ×1
  • Duplicated block (15–18 lines × 3) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:468 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:468-482 | crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:640-657 | crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:1262-1279 — 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–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) crates/jcode-tui-mermaid/src/mermaid_inline.rs:168 — crates/jcode-tui-mermaid/src/mermaid_inline.rs:168-185 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:221-237 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:667-683 — 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.
D4 · Code Duplication · Duplicated block (3–17 lines × 3) · ×1
  • Duplicated block (3–17 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:52 — crates/jcode-tui-account-picker/src/overlay.rs:52-54 | crates/jcode-tui-usage-overlay/src/lib.rs:251-267 | crates/jcode-tui/src/tui/login_picker.rs:149-165 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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–17 lines × 2) · ×1
  • Duplicated block (11–17 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2069 — crates/jcode-tui/src/tui/session_picker/loading.rs:2069-2085 | crates/jcode-tui/src/tui/session_picker/loading.rs:2856-2866 — both copies are in the same file, so extract the 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) src/cli/acp.rs:431 — src/cli/acp.rs:431-444 | src/cli/acp.rs:486-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.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:1487 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:1487-1501 | crates/jcode-tui/src/tui/app/turn.rs:421-435 | crates/jcode-tui/src/tui/app/turn.rs:484-498 | crates/jcode-tui/src/tui/app/turn.rs:1279-1293 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–15 lines × 4) · ×1
  • Duplicated block (3–15 lines × 4) crates/jcode-app-core/src/tool/read.rs:406 — crates/jcode-app-core/src/tool/read.rs:406-420 | crates/jcode-base/src/provider/image_clamp.rs:409-422 | crates/jcode-terminal-image/src/display.rs:234-248 | crates/jcode-tui-mermaid/src/lib.rs:1552-1554 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.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. 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–15 lines × 2) · ×1
  • Duplicated block (9–15 lines × 2) crates/jcode-base/src/platform.rs:389 — crates/jcode-base/src/platform.rs:389-397 | crates/jcode-build-support/src/platform_support.rs:26-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) crates/jcode-provider-bedrock/src/lib.rs:510 — crates/jcode-provider-bedrock/src/lib.rs:510-524 | crates/jcode-schema-dialect/src/dialect.rs:343-354 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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.
D4 · Code Duplication · Duplicated block (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) crates/jcode-app-core/src/tool/discover.rs:1120 — crates/jcode-app-core/src/tool/discover.rs:1120-1129 | crates/jcode-app-core/src/tool/discover.rs:1406-1419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) crates/jcode-tui/src/tui/keybind.rs:95 — crates/jcode-tui/src/tui/keybind.rs:95-108 | crates/jcode-tui/src/tui/keybind.rs:144-154 — both copies are in the same file, so extract the 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–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) src/bin/memory_recall_bench.rs:1742 — src/bin/memory_recall_bench.rs:1742-1751 | src/bin/memory_recall_bench.rs:1941-1953 — both copies are in the same file, so extract the 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 × 4) · ×1
  • Duplicated block (10–12 lines × 4) crates/jcode-app-core/src/perf.rs:366 — crates/jcode-app-core/src/perf.rs:366-377 | crates/jcode-setup-hints/src/lib.rs:2391-2400 | crates/jcode-tui-style/src/color.rs:60-70 | crates/jcode-tui-workspace/src/color_support.rs:31-41 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 212 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–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) crates/jcode-harness-api-server/src/translate.rs:2219 — crates/jcode-harness-api-server/src/translate.rs:2219-2230 | crates/jcode-harness-api-server/src/translate.rs:2624-2632 — both copies are in the same file, so extract the 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 (4–12 lines × 3) · ×1
  • Duplicated block (4–12 lines × 3) crates/jcode-tui/src/tui/ui_inline_interactive.rs:893 — crates/jcode-tui/src/tui/ui_inline_interactive.rs:893-904 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:972-983 | crates/jcode-tui/src/tui/ui_input/command_suggestions.rs:94-97 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) crates/jcode-base/src/embedding_stub.rs:69 — crates/jcode-base/src/embedding_stub.rs:69-79 | crates/jcode-embedding/src/lib.rs:68-78 | crates/jcode-memory-types/src/graph.rs:71-81 | crates/jcode-memory-types/src/lib.rs:894-904 | crates/jcode-memory-types/src/lib.rs:967-977 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.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. 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–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) crates/jcode-import-core/src/lib.rs:741 — crates/jcode-import-core/src/lib.rs:741-749 | crates/jcode-tui/src/tui/session_picker/loading.rs:2334-2344 | crates/jcode-tui/src/tui/session_picker/loading.rs:2418-2428 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 139 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 (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) crates/jcode-tui/src/tui/mod.rs:1729 — crates/jcode-tui/src/tui/mod.rs:1729-1739 | crates/jcode-tui/src/tui/mod.rs:1744-1754 | crates/jcode-tui/src/tui/mod.rs:2030-2039 — 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 × 8) · ×1
  • Duplicated block (9–10 lines × 8) crates/jcode-provider-cursor-runtime/src/wire.rs:711 — crates/jcode-provider-cursor-runtime/src/wire.rs:711-720 | crates/jcode-provider-cursor-runtime/src/wire.rs:732-740 | crates/jcode-provider-cursor-runtime/src/wire.rs:769-777 | crates/jcode-provider-cursor-runtime/src/wire.rs:844-852 | crates/jcode-provider-cursor-runtime/src/wire.rs:874-883 | crates/jcode-provider-cursor-runtime/src/wire.rs:893-902 | crates/jcode-provider-cursor-runtime/src/wire.rs:919-928 | crates/jcode-provider-cursor-runtime/src/wire.rs:937-946 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) crates/jcode-provider-doctor/src/live_provider_probes.rs:805 — crates/jcode-provider-doctor/src/live_provider_probes.rs:805-814 | crates/jcode-provider-doctor/src/live_provider_probes.rs:903-912 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1133-1142 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1223-1232 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1324-1333 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1415-1424 — 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 (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) crates/jcode-app-core/src/agent/status.rs:174 — crates/jcode-app-core/src/agent/status.rs:174-183 | crates/jcode-app-core/src/agent/turn_execution.rs:1503-1512 | crates/jcode-compaction-core/src/lib.rs:219-227 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:485 — crates/jcode-tui-markdown/src/markdown_render_full.rs:485-493 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:460-465 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 863 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 lines × 5) · ×1
  • Duplicated block (8 lines × 5) crates/jcode-tui/src/tui/keybind.rs:67 — crates/jcode-tui/src/tui/keybind.rs:67-74 | crates/jcode-tui/src/tui/keybind.rs:650-657 | crates/jcode-tui/src/tui/keybind.rs:667-674 | crates/jcode-tui/src/tui/keybind.rs:684-691 | crates/jcode-tui/src/tui/keybind.rs:701-708 — 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 (5–8 lines × 3) · ×1
  • Duplicated block (5–8 lines × 3) crates/jcode-base/src/import.rs:1080 — crates/jcode-base/src/import.rs:1080-1087 | crates/jcode-import-core/src/lib.rs:653-657 | crates/jcode-tui/src/tui/session_picker/loading.rs:2142-2148 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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 (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) crates/jcode-app-core/src/tool/skill.rs:352 — crates/jcode-app-core/src/tool/skill.rs:352-359 | crates/jcode-tui/src/tui/app/state_ui.rs:1878-1883 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) crates/jcode-tui-account-picker/src/overlay.rs:462 — crates/jcode-tui-account-picker/src/overlay.rs:462-468 | crates/jcode-tui-account-picker/src/overlay.rs:587-593 | crates/jcode-tui-usage-overlay/src/lib.rs:444-450 | crates/jcode-tui/src/tui/login_picker.rs:350-356 | crates/jcode-tui/src/tui/login_picker.rs:480-486 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 146 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) crates/jcode-app-core/src/session_launch.rs:250 — crates/jcode-app-core/src/session_launch.rs:250-254 | crates/jcode-app-core/src/session_launch.rs:297-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) crates/jcode-provider-core/src/openai_schema.rs:45 — crates/jcode-provider-core/src/openai_schema.rs:45-47 | crates/jcode-provider-core/src/openai_schema.rs:179-183 | crates/jcode-schema-dialect/src/dialect.rs:264-268 — 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.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) crates/jcode-tui-mermaid/src/lib.rs:796 — crates/jcode-tui-mermaid/src/lib.rs:796-801 | crates/jcode-tui-mermaid/src/lib.rs:1080-1085 | crates/jcode-tui-mermaid/src/lib.rs:1178-1183 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:71-76 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:380-385 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) crates/jcode-tui/src/tui/app/state_ui_storage.rs:267 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:267-283 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:334-360 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:373-400 — 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 (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) crates/jcode-app-core/src/server/client_actions.rs:928 — crates/jcode-app-core/src/server/client_actions.rs:928-946 | crates/jcode-app-core/src/server/client_actions.rs:982-1000 | crates/jcode-app-core/src/server/client_actions.rs:1015-1033 | crates/jcode-app-core/src/server/client_actions.rs:1038-1056 — 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 × 6) · ×1
  • Duplicated block (5 lines × 6) crates/jcode-tui/src/tui/ui_overlays.rs:350 — crates/jcode-tui/src/tui/ui_overlays.rs:350-354 | crates/jcode-tui/src/tui/ui_overlays.rs:440-444 | crates/jcode-tui/src/tui/ui_overlays.rs:457-461 | crates/jcode-tui/src/tui/ui_overlays.rs:481-485 | crates/jcode-tui/src/tui/ui_overlays.rs:550-554 | crates/jcode-tui/src/tui/ui_overlays.rs:622-627 — 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 (33–40 lines × 2) · ×1
  • Duplicated block (33–40 lines × 2) scripts/repro_input_flicker.py:480 — scripts/repro_input_flicker.py:480-512 | scripts/repro_input_lag.py:458-497 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_input_lag.py:458` it begins part-way through the construct above it, so those 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 (38–39 lines × 2) · ×1
  • Duplicated block (38–39 lines × 2) scripts/benchmark_swarm.py:248 — scripts/benchmark_swarm.py:248-286 | scripts/benchmark_swarm.py:327-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (33–39 lines × 2) · ×1
  • Duplicated block (33–39 lines × 2) scripts/check_code_size_budget.py:111 — scripts/check_code_size_budget.py:111-149 | scripts/check_test_size_budget.py:99-131 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_code_size_budget.py:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) scripts/benchmark_swarm.py:46 — scripts/benchmark_swarm.py:46-80 | scripts/benchmark_takehome.py:32-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/benchmark_takehome.py:27` calls `get` and `scripts/benchmark_swarm.py:37` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (33–35 lines × 2) · ×1
  • Duplicated block (33–35 lines × 2) scripts/diagnose_idle_render_cost.py:329 — scripts/diagnose_idle_render_cost.py:329-361 | scripts/repro_slash_flicker.py:358-392 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_slash_flicker.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) scripts/measure_animation_cpu_cost.py:101 — scripts/measure_animation_cpu_cost.py:101-128 | scripts/sweep_animation_fps.py:92-118 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–25 lines × 6) · ×1
  • Duplicated block (20–25 lines × 6) scripts/check_donut_animates_live.py:80 — scripts/check_donut_animates_live.py:80-99 | scripts/dump_fresh_spawn_screen.py:44-63 | scripts/pin_no_area_state.py:49-68 | scripts/verify_donut_still_animates.py:79-103 | scripts/which_overlay_blocks_donut.py:53-72 | scripts/why_no_animation_area.py:44-63 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/dump_fresh_spawn_screen.py` as WHOLE FILES: this scan already matched 7 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_donut_animates_live.py:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–23 lines × 2) · ×1
  • Duplicated block (19–23 lines × 2) scripts/benchmark_takehome.py:139 — scripts/benchmark_takehome.py:139-157 | scripts/benchmark_takehome.py:232-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.
D4 · Code Duplication · Duplicated block (10–23 lines × 2) · ×1
  • Duplicated block (10–23 lines × 2) scripts/check_donut_animates_live.py:110 — scripts/check_donut_animates_live.py:110-119 | scripts/verify_donut_still_animates.py:114-136 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/verify_donut_still_animates.py` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 141 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×1
  • Duplicated block (17–21 lines × 2) scripts/bench_headless_memory.py:88 — scripts/bench_headless_memory.py:88-108 | scripts/repro_idle_session_rss.py:107-123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/bench_headless_memory.py:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–19 lines × 8) · ×1
  • Duplicated block (13–19 lines × 8) scripts/check_donut_animates_live.py:79 — scripts/check_donut_animates_live.py:79-92 | scripts/count_idle_draws.py:58-73 | scripts/dump_fresh_spawn_screen.py:43-56 | scripts/pin_no_area_state.py:48-61 | scripts/probe_idle_state.py:103-115 | scripts/verify_donut_still_animates.py:78-96 | scripts/which_overlay_blocks_donut.py:52-65 | scripts/why_no_animation_area.py:43-56 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` 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. 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 lines × 6) · ×1
  • Duplicated block (16 lines × 6) scripts/diagnose_idle_render_cost.py:151 — scripts/diagnose_idle_render_cost.py:151-166 | scripts/repro_expand_edit_shortcut.py:194-209 | scripts/repro_input_flicker.py:212-227 | scripts/repro_input_lag.py:170-185 | scripts/repro_live_duplicate.py:164-179 | scripts/repro_slash_flicker.py:172-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/repro_input_lag.py:186` calls `monotonic` and `scripts/repro_expand_edit_shortcut.py:210` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) scripts/diagnose_idle_render_cost.py:200 — scripts/diagnose_idle_render_cost.py:200-215 | scripts/repro_input_flicker.py:275-290 | scripts/repro_input_lag.py:249-264 | scripts/repro_slash_flicker.py:218-233 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) scripts/check_panic_budget.py:182 — scripts/check_panic_budget.py:182-194 | scripts/check_swallowed_error_budget.py:231-245 | scripts/check_test_size_budget.py:129-143 — before extracting anything, compare `scripts/check_panic_budget.py` and `scripts/check_swallowed_error_budget.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_swallowed_error_budget.py:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 10) · ×1
  • Duplicated block (14 lines × 10) scripts/check_donut_animates_live.py:163 — scripts/check_donut_animates_live.py:163-176 | scripts/count_idle_draws.py:152-165 | scripts/diagnose_idle_render_cost.py:430-443 | scripts/dump_fresh_spawn_screen.py:114-127 | scripts/pin_no_area_state.py:115-128 | scripts/probe_idle_state.py:193-206 | scripts/repro_slash_flicker.py:482-495 | scripts/verify_donut_still_animates.py:232-245 | scripts/which_overlay_blocks_donut.py:105-118 | scripts/why_no_animation_area.py:120-133 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_donut_animates_live.py:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/pin_no_area_state.py:113` calls `sleep` and `scripts/diagnose_idle_render_cost.py:428` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) scripts/diagnose_idle_render_cost.py:97 — scripts/diagnose_idle_render_cost.py:97-110 | scripts/repro_expand_edit_shortcut.py:103-116 | scripts/repro_input_flicker.py:108-121 | scripts/repro_input_lag.py:110-123 | scripts/repro_slash_flicker.py:104-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 8) · ×1
  • Duplicated block (13 lines × 8) scripts/diagnose_idle_render_cost.py:78 — scripts/diagnose_idle_render_cost.py:78-90 | scripts/profile_remote_resume_burst.py:77-89 | scripts/profile_single_spawn.py:27-39 | scripts/repro_expand_edit_shortcut.py:144-156 | scripts/repro_input_flicker.py:89-101 | scripts/repro_input_lag.py:91-103 | scripts/repro_live_duplicate.py:114-126 | scripts/repro_slash_flicker.py:85-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 30.0` in one and `float = 10.0` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) scripts/diagnose_idle_render_cost.py:94 — scripts/diagnose_idle_render_cost.py:94-106 | scripts/repro_expand_edit_shortcut.py:100-112 | scripts/repro_input_flicker.py:105-117 | scripts/repro_input_lag.py:107-119 | scripts/repro_live_duplicate.py:68-80 | scripts/repro_slash_flicker.py:101-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–13 lines × 5) · ×1
  • Duplicated block (12–13 lines × 5) scripts/diagnose_idle_render_cost.py:129 — scripts/diagnose_idle_render_cost.py:129-140 | scripts/repro_expand_edit_shortcut.py:288-300 | scripts/repro_input_flicker.py:140-151 | scripts/repro_input_lag.py:143-154 | scripts/repro_slash_flicker.py:136-147 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 10.0` in one and `float = 6.0` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) scripts/diagnose_idle_render_cost.py:324 — scripts/diagnose_idle_render_cost.py:324-336 | scripts/repro_input_flicker.py:484-496 | scripts/repro_input_lag.py:463-475 | scripts/repro_slash_flicker.py:353-365 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) scripts/profile_idle_donut.py:144 — scripts/profile_idle_donut.py:144-156 | scripts/which_overlay_blocks_donut.py:104-116 | scripts/why_no_animation_area.py:119-131 — before extracting anything, compare `scripts/profile_idle_donut.py` and `scripts/which_overlay_blocks_donut.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) scripts/diagnose_idle_render_cost.py:167 — scripts/diagnose_idle_render_cost.py:167-178 | scripts/repro_expand_edit_shortcut.py:211-222 | scripts/repro_input_flicker.py:234-245 | scripts/repro_input_lag.py:190-201 | scripts/repro_live_duplicate.py:181-192 | scripts/repro_slash_flicker.py:193-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/repro_slash_flicker.py:192` calls `feed`, `decode` and `scripts/repro_input_lag.py:189` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–9 lines × 4) · ×1
  • Duplicated block (6–9 lines × 4) scripts/check_code_size_budget.py:135 — scripts/check_code_size_budget.py:135-143 | scripts/check_panic_budget.py:174-179 | scripts/check_swallowed_error_budget.py:223-228 | scripts/check_test_size_budget.py:121-127 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_code_size_budget.py:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5–9 lines × 2) · ×1
  • Duplicated block (5–9 lines × 2) scripts/dump_fresh_spawn_screen.py:37 — scripts/dump_fresh_spawn_screen.py:37-41 | scripts/repro_real_spawn_lag.py:140-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_real_spawn_lag.py:140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 8) · ×1
  • Duplicated block (8 lines × 8) scripts/check_donut_animates_live.py:93 — scripts/check_donut_animates_live.py:93-100 | scripts/count_idle_draws.py:76-83 | scripts/dump_fresh_spawn_screen.py:57-64 | scripts/pin_no_area_state.py:62-69 | scripts/probe_idle_state.py:122-129 | scripts/verify_donut_still_animates.py:97-104 | scripts/which_overlay_blocks_donut.py:66-73 | scripts/why_no_animation_area.py:57-64 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` 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. 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 lines × 7) · ×1
  • Duplicated block (8 lines × 7) scripts/diagnose_idle_render_cost.py:324 — scripts/diagnose_idle_render_cost.py:324-331 | scripts/repro_expand_edit_shortcut.py:436-443 | scripts/repro_input_flicker.py:483-491 | scripts/repro_input_lag.py:462-470 | scripts/repro_live_duplicate.py:447-454 | scripts/repro_slash_flicker.py:353-360 | scripts/repro_startup_lag.py:83-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_input_flicker.py:483` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/repro_live_duplicate.py:446` calls `add_argument`, `parse_args` and `scripts/repro_input_flicker.py:483` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) scripts/diagnose_idle_render_cost.py:336 — scripts/diagnose_idle_render_cost.py:336-343 | scripts/profile_idle_donut.py:69-76 | scripts/profile_remote_resume_burst.py:327-334 | scripts/repro_expand_edit_shortcut.py:449-456 | scripts/repro_live_duplicate.py:460-467 | scripts/repro_slash_flicker.py:365-372 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 40 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 (7 lines × 8) · ×1
  • Duplicated block (7 lines × 8) scripts/diagnose_idle_render_cost.py:337 — scripts/diagnose_idle_render_cost.py:337-343 | scripts/profile_idle_donut.py:70-76 | scripts/profile_remote_resume_burst.py:328-334 | scripts/repro_expand_edit_shortcut.py:450-456 | scripts/repro_input_flicker.py:503-509 | scripts/repro_input_lag.py:486-492 | scripts/repro_live_duplicate.py:461-467 | scripts/repro_slash_flicker.py:366-372 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 40 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 (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) scripts/diagnose_idle_render_cost.py:220 — scripts/diagnose_idle_render_cost.py:220-226 | scripts/repro_input_flicker.py:295-300 | scripts/repro_slash_flicker.py:238-244 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/repro_input_flicker.py:304` calls `setdefault` and `scripts/diagnose_idle_render_cost.py:227` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) scripts/check_donut_animates_live.py:79 — scripts/check_donut_animates_live.py:79-84 | scripts/count_idle_draws.py:58-63 | scripts/dump_fresh_spawn_screen.py:43-48 | scripts/pin_no_area_state.py:48-53 | scripts/probe_idle_state.py:103-108 | scripts/profile_idle_donut.py:64-69 | scripts/verify_donut_still_animates.py:78-83 | scripts/which_overlay_blocks_donut.py:52-57 | scripts/why_no_animation_area.py:43-48 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` 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. 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 (4–5 lines × 4) · ×1
  • Duplicated block (4–5 lines × 4) scripts/count_idle_draws.py:53 — scripts/count_idle_draws.py:53-57 | scripts/pin_no_area_state.py:44-47 | scripts/probe_idle_state.py:98-102 | scripts/which_overlay_blocks_donut.py:48-51 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/count_idle_draws.py:50` calls `add_argument` and `scripts/probe_idle_state.py:97` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (26 lines × 4) · ×1
  • Duplicated block (26 lines × 4) scripts/bench_memory_cli.py:162 — scripts/bench_memory_cli.py:162-188 | scripts/bench_startup_visible_ready.py:131-157 | scripts/profile_remote_resume_burst.py:120-145 | scripts/profile_single_spawn.py:70-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Near-duplicate member family (4 members, 46 shared lines) · ×1
  • Near-duplicate member family (4 members, 46 shared lines) crates/jcode-provider-doctor/src/provider_e2e.rs:873 — crates/jcode-provider-doctor/src/provider_e2e.rs:873-947 | crates/jcode-provider-doctor/src/provider_e2e.rs:1216-1291 | crates/jcode-provider-doctor/src/provider_e2e.rs:1868-1943 | crates/jcode-provider-doctor/src/provider_e2e.rs:2184-2251 — These 4 members are variants of one another: a block of 46 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 · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:922 — crates/jcode-provider-doctor/src/provider_e2e.rs:922-939 | crates/jcode-provider-doctor/src/provider_e2e.rs:1266-1283 | crates/jcode-provider-doctor/src/provider_e2e.rs:1918-1935 | crates/jcode-provider-doctor/src/provider_e2e.rs:2233-2250 — 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 (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:487 — crates/jcode-provider-doctor/src/provider_e2e.rs:487-503 | crates/jcode-provider-doctor/src/provider_e2e.rs:779-795 | crates/jcode-provider-doctor/src/provider_e2e.rs:1139-1155 | crates/jcode-provider-doctor/src/provider_e2e.rs:1770-1786 — 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.
D5 · Coupling · Unstable project jcode-app-core · ×1
  • Unstable project jcode-app-core — jcode-app-core has instability 0.97 with 1 dependents.
D5 · Coupling · Unstable project jcode-protocol · ×1
  • Unstable project jcode-protocol — jcode-protocol has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project jcode-provider-bedrock · ×1
  • Unstable project jcode-provider-bedrock — jcode-provider-bedrock has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project jcode-provider-doctor · ×1
  • Unstable project jcode-provider-doctor — jcode-provider-doctor has instability 0.89 with 1 dependents.
D5 · Coupling · Unstable project jcode-setup-hints · ×1
  • Unstable project jcode-setup-hints — jcode-setup-hints has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project jcode-telemetry-core · ×1
  • Unstable project jcode-telemetry-core — jcode-telemetry-core has instability 0.88 with 1 dependents.
D5 · Coupling · Unstable project jcode-tui · ×1
  • Unstable project jcode-tui — jcode-tui has instability 0.96 with 1 dependents.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 15 plain JS — the untyped files are telemetry-worker/scripts/model-price-report.mjs, telemetry-worker/scripts/move-bulk-events.mjs, telemetry-worker/scripts/run-dashboard.mjs, telemetry-worker/scripts/sync-model-prices.mjs, telemetry-worker/src/concurrency.js, telemetry-worker/src/model-pricing.js (+9 more).
R10 · Code Duplication · Duplicated block with local edits (38 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (38 matched lines × 2 locations) telemetry-worker/src/worker.js:1539 — telemetry-worker/src/worker.js:1539 · telemetry-worker/src/worker.js:1753 — the two spans are one implementation copied and then locally edited — 372 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 (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) telemetry-worker/src/worker.js:286 — telemetry-worker/src/worker.js:286 · telemetry-worker/src/worker.js:430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×1
  • Duplicated block (16 lines × 2 locations) telemetry-worker/src/worker.js:421 — telemetry-worker/src/worker.js:421 · telemetry-worker/src/worker.js:469 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 4 locations) · ×1
  • Duplicated block (12 lines × 4 locations) telemetry-worker/src/worker.js:1166 — telemetry-worker/src/worker.js:1166 · telemetry-worker/src/worker.js:1182 · telemetry-worker/src/worker.js:1198 · telemetry-worker/src/worker.js:1230 — all 4 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 (12 lines × 3 locations) · ×1
  • Duplicated block (12 lines × 3 locations) telemetry-worker/src/worker.js:1968 — telemetry-worker/src/worker.js:1968 · telemetry-worker/src/worker.js:2004 · telemetry-worker/src/worker.js:2031 — 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 (9 lines × 3 locations) · ×1
  • Duplicated block (9 lines × 3 locations) telemetry-worker/src/worker.js:1949 — telemetry-worker/src/worker.js:1949 · telemetry-worker/src/worker.js:1975 · telemetry-worker/src/worker.js:2038 — 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 (8 lines × 2 locations) · ×1
  • Duplicated block (8 lines × 2 locations) telemetry-worker/src/worker.js:1190 — telemetry-worker/src/worker.js:1190 · telemetry-worker/src/worker.js:1206 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (6 lines × 3 locations) · ×1
  • Duplicated block (6 lines × 3 locations) telemetry-worker/src/worker.js:406 — telemetry-worker/src/worker.js:406 · telemetry-worker/src/worker.js:462 · telemetry-worker/src/worker.js:485 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication · Duplicated block (6 lines × 2 locations) · ×1
  • Duplicated block (6 lines × 2 locations) telemetry-worker/src/worker.js:2192 — telemetry-worker/src/worker.js:2192 · telemetry-worker/src/worker.js:2227 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function insertEvent (cyclomatic 135, cognitive 145) · ×1
  • Complex function insertEvent (cyclomatic 135, cognitive 145) telemetry-worker/src/worker.js:1143 — insertEvent has cyclomatic complexity 135 and cognitive complexity 145; 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 fetch (cyclomatic 61, cognitive 68) · ×1
  • Complex function fetch (cyclomatic 61, cognitive 68) telemetry-worker/src/worker.js:505 — fetch has cyclomatic complexity 61 and cognitive complexity 68; 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 insertTurnDetails (cyclomatic 49, cognitive 46) · ×1
  • Complex function insertTurnDetails (cyclomatic 49, cognitive 46) telemetry-worker/src/worker.js:1539 — insertTurnDetails has cyclomatic complexity 49 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function classifyConcurrency (cyclomatic 40, cognitive 38) · ×1
  • Complex function classifyConcurrency (cyclomatic 40, cognitive 38) telemetry-worker/src/concurrency.js:20 — classifyConcurrency has cyclomatic complexity 40 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeUsageReportEvent (cyclomatic 38, cognitive 37) · ×1
  • Complex function normalizeUsageReportEvent (cyclomatic 38, cognitive 37) telemetry-worker/src/worker.js:2323 — normalizeUsageReportEvent has cyclomatic complexity 38 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function oauthAccount (cyclomatic 38, cognitive 33) · ×1
  • Complex function oauthAccount (cyclomatic 38, cognitive 33) telemetry-worker/src/oauth-account.js:14 — oauthAccount has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertSessionDetails (cyclomatic 35, cognitive 32) · ×1
  • Complex function insertSessionDetails (cyclomatic 35, cognitive 32) telemetry-worker/src/worker.js:1753 — insertSessionDetails has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeWebEvent (cyclomatic 33, cognitive 38) · ×1
  • Complex function normalizeWebEvent (cyclomatic 33, cognitive 38) telemetry-worker/src/worker.js:2062 — normalizeWebEvent has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 insertTodoSessionDetails (cyclomatic 28, cognitive 25) · ×1
  • Complex function insertTodoSessionDetails (cyclomatic 28, cognitive 25) telemetry-worker/src/worker.js:1975 — insertTodoSessionDetails has cyclomatic complexity 28 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function pruneOldEvents (cyclomatic 27, cognitive 55) · ×1
  • Complex function pruneOldEvents (cyclomatic 27, cognitive 55) telemetry-worker/src/worker.js:1015 — pruneOldEvents has cyclomatic complexity 27 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertWebDetails (cyclomatic 21, cognitive 18) · ×1
  • Complex function insertWebDetails (cyclomatic 21, cognitive 18) telemetry-worker/src/worker.js:2011 — insertWebDetails has cyclomatic complexity 21 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function resolvePriceRows (cyclomatic 20, cognitive 30) · ×1
  • Complex function resolvePriceRows (cyclomatic 20, cognitive 30) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows has cyclomatic complexity 20 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeDiscoveryEvent (cyclomatic 19, cognitive 21) · ×1
  • Complex function normalizeDiscoveryEvent (cyclomatic 19, cognitive 21) telemetry-worker/src/worker.js:2203 — normalizeDiscoveryEvent has cyclomatic complexity 19 and cognitive complexity 21; 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 validateTranscript (cyclomatic 17, cognitive 14) · ×1
  • Complex function validateTranscript (cyclomatic 17, cognitive 14) telemetry-worker/src/worker.js:857 — validateTranscript has cyclomatic complexity 17 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 16, cognitive 27) · ×1
  • Complex function (anonymous) (cyclomatic 16, cognitive 27) telemetry-worker/scripts/move-bulk-events.mjs:90 — (anonymous) has cyclomatic complexity 16 and cognitive complexity 27; 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 normalizeInstallFunnelEvent (cyclomatic 16, cognitive 16) · ×1
  • Complex function normalizeInstallFunnelEvent (cyclomatic 16, cognitive 16) telemetry-worker/src/worker.js:2147 — normalizeInstallFunnelEvent has cyclomatic complexity 16 and cognitive complexity 16; 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 q (cyclomatic 15, cognitive 24) · ×1
  • Complex function q (cyclomatic 15, cognitive 24) telemetry-worker/scripts/move-bulk-events.mjs:32 — q has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 15, cognitive 16) · ×1
  • Complex function (anonymous) (cyclomatic 15, cognitive 16) telemetry-worker/src/worker.js:694 — (anonymous) has cyclomatic complexity 15 and cognitive complexity 16; 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 writeFirehose (cyclomatic 15, cognitive 14) · ×1
  • Complex function writeFirehose (cyclomatic 15, cognitive 14) telemetry-worker/src/worker.js:369 — writeFirehose has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · telemetry-worker/src/worker.js · ×1
  • telemetry-worker/src/worker.js: 2307 lines of code telemetry-worker/src/worker.js:1 — telemetry-worker/src/worker.js has 2307 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
X15 · Unvalidated length from an untrusted reader · Length read from the parsed input is spent without ever being bounded · ×1
  • Length read from the parsed input is spent without ever being bounded crates/jcode-app-core/src/tool/session_search_index.rs:284 — `entry_count` is read from the bytes being parsed at line 283 (`read_u32`), then used to size a `Vec::with_capacity` at line 284 — and nowhere in its scope is `entry_count` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `entry_count` against the bytes actually remaining and a maximum the format allows before allocating.
Minor — 96 finding(s)
X7 · Silent fallback defaults · Silent fallback default on Err · ×36
  • Silent fallback default on Err crates/jcode-app-core/src/ambient/runner.rs:326 — `queue_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/jcode-app-core/src/ambient/runner.rs:367 — `log_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/jcode-app-core/src/ambient/prompt.rs:176 — `gather_recent_sessions` 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/jcode-app-core/src/catchup.rs:257 — `load_seen_state` turns every `Err` into `PersistedCatchupState::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/jcode-app-core/src/server/await_members_state.rs:366 — `scan_pending_await_members_including_expired` 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/jcode-app-core/src/server/idle_hibernation.rs:78 — `reclaim_idle_caches` 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/jcode-app-core/src/server/swarm_watchdog.rs:133 — `update_stalls` 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/jcode-app-core/src/session_active_pids.rs:39 — `active_session_ids` 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/jcode-app-core/src/session_rebuild.rs:241 — `rebuild_version_label` turns every `Err` into `"local source build".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/jcode-app-core/src/telemetry_state.rs:172 — `prune_active_session_files` 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/jcode-app-core/src/tool/communicate.rs:283 — `cleanup_finished_workers_for_capacity` 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/jcode-base/src/gateway/registry.rs:23 — `load` turns every `Err` into `Self::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/jcode-base/src/mcp/schema_cache.rs:133 — `load_uncached` turns every `Err` into `Self::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/jcode-base/src/skill.rs:414 — `installed_plugin_paths` 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/jcode-base/src/auth/refresh_state.rs:145 — `load_all` turns every `Err` into `BTreeMap::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/jcode-base/src/auth/validation.rs:14 — `load_all` turns every `Err` into `BTreeMap::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/jcode-base/src/mcp/oauth.rs:99 — `canonical_resource` 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/jcode-base/src/model_usage.rs:180 — `legacy_selections` 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/jcode-base/src/scratch_maintenance.rs:163 — `busy_process_dirs` 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/jcode-base/src/session/crash.rs:417 — `find_crashed_legacy_scan` 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/jcode-base/src/session/prewarm.rs:104 — `sessions_owned_by` 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/jcode-base/src/usage.rs:701 — `enqueue_openai_usage_tasks` 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/jcode-base/src/usage/accessors.rs:312 — `get_openai_usage_for_email_sync` turns every `Err` into `OpenAIUsageData::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/jcode-base/src/usage/provider_fetch.rs:129 — `fetch_all_openai_usage_reports` 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/jcode-build-support/src/version_gc.rs:102 — `running_versions` turns every `Err` into `HashSet::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.
  • + 11 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate scripts/measure_animation_cpu_cost.py:153 — `args.session or recent_session(debug_sock, str(REPO_ROOT))` appears character-identically in 3 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/jcode_harbor_agent.py:37 — `candidate.exists() and candidate.is_file()` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/repro_input_flicker.py:498 — `env.get("JCODE_RUNTIME_DIR") or f"/run/user/{os.getuid()}"` appears character-identically in 3 files — scripts/repro_input_flicker.py, scripts/repro_input_lag.py, scripts/repro_startup_lag.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/repro_input_flicker.py:499 — `env.get("JCODE_SOCKET") or str(real_runtime / "jcode.sock")` appears character-identically in 2 files — scripts/repro_input_flicker.py, scripts/repro_input_lag.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/measure_animation_cpu_cost.py:69 — `env.get("JCODE_SOCKET") or str(runtime / "jcode.sock")` appears character-identically in 5 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py, scripts/repro_startup_lag.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/jcode_harbor_agent.py:294 — `isinstance(cache_read, int) and isinstance(cache_create, int)` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_code_size_budget.py:52 — `name == "REDACTED" or name.endswith("_tests.rs") or name.endswith("_test.rs") or name.startswith("tests_")` appears character-identically in 4 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py, scripts/check_test_size_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/cloud_acceptance_tui.py:363 — `not entry.name.isdigit() or int(entry.name) == os.getpid()` appears character-identically in 2 files — scripts/cloud_acceptance_tui.py, scripts/update_rehearsal.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_code_size_budget.py:91 — `not isinstance(k, str) or not isinstance(v, int) or v <= 0` appears character-identically in 3 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_test_size_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_code_size_budget.py:88 — `not isinstance(threshold, int) or threshold <= 0` appears character-identically in 2 files — scripts/check_code_size_budget.py, scripts/check_test_size_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/measure_animation_cpu_cost.py:66 — `os.environ.get("JCODE_RUNTIME_DIR") or f"/run/user/{os.getuid()}"` appears character-identically in 4 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py, scripts/sweep_animation_fps.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_donut_animates_live.py:78 — `os.environ.get("JCODE_SCRATCH_DIR") or tempfile.gettempdir()` appears character-identically in 13 files — scripts/check_donut_animates_live.py, scripts/count_idle_draws.py, scripts/dump_fresh_spawn_screen.py, scripts/measure_animation_cpu_cost.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/jcode_harbor_agent.py:29 — `os.environ.get(env_name) or default_path` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_code_size_budget.py:46 — `part == "tests" or part.endswith("_tests") or part.endswith("_test") or part.startswith("tests_")` appears character-identically in 4 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py, scripts/check_test_size_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_panic_budget.py:64 — `path.suffix == ".rs" and not is_test_rust_file(path)` appears character-identically in 2 files — scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_panic_budget.py:89 — `pending_cfg_test and ITEM_START_RE.match(line)` appears character-identically in 2 files — scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/check_panic_budget.py:95 — `pending_cfg_test and stripped and not stripped.startswith("#")` appears character-identically in 2 files — scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/benchmark_discovery.py:466 — `process.stdout is not None and process.stderr is not None` appears character-identically in 2 files — scripts/benchmark_discovery.py, scripts/benchmark_discovery_rate.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/profile_idle_donut.py:123 — `rec.returncode != 0 or not data.exists()` appears character-identically in 2 files — scripts/profile_idle_donut.py, scripts/profile_real_spawn.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/bench_headless_memory.py:223 — `shutil.which("claude") or str(Path.home() / ".local/bin/claude")` appears character-identically in 2 files — scripts/bench_headless_memory.py, scripts/bench_memory_cli.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/jcode-base/src/provider/pricing.rs:86 — `!creds.refresh_token.is_empty() || creds.id_token.is_some()` appears character-identically in 5 files — crates/jcode-base/src/provider/pricing.rs, crates/jcode-base/src/sidecar.rs, crates/jcode-base/src/usage.rs, crates/jcode-base/src/usage/provider_fetch.rs. 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/jcode-base/src/usage.rs:704 — `!is_chatgpt || creds.access_token.is_empty()` appears character-identically in 2 files — crates/jcode-base/src/usage.rs, crates/jcode-base/src/usage/provider_fetch.rs. 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/jcode-tui-account-picker/src/overlay.rs:363 — `!modifiers.contains(KeyModifiers::CONTROL) && !modifiers.contains(KeyModifiers::ALT)` appears character-identically in 3 files — crates/jcode-tui-account-picker/src/overlay.rs, crates/jcode-tui-usage-overlay/src/lib.rs, crates/jcode-tui/src/tui/login_picker.rs. 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/jcode-setup-hints/src/linux_env.rs:598 — `!new_text.is_empty() && !new_text.ends_with('\n')` appears character-identically in 2 files — crates/jcode-setup-hints/src/linux_env.rs, crates/jcode-setup-hints/src/linux_niri.rs. 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/jcode-app-core/src/server/client_actions.rs:61 — `!output.is_empty() && !output.ends_with('\n')` appears character-identically in 2 files — crates/jcode-app-core/src/server/client_actions.rs, crates/jcode-tui/src/tui/app/input/shell_commands.rs. 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.
X9 · Subsumed condition operand · Subsumed condition operand · ×23
  • Subsumed condition operand scripts/repro/tls-bad-record-mac/src/main.rs:35 — `lower.contains("operation timed out")` can never decide this `||` — every value satisfying `lower.contains("operation timed out")` also satisfies `lower.contains("timed out")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:42 — `lower.contains("fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:43 — `lower.contains("fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:44 — `lower.contains("received fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:45 — `lower.contains("received fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:83 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:86 — `error_str.contains("504 gateway timeout")` can never decide this `||` — every value satisfying `error_str.contains("504 gateway timeout")` also satisfies `error_str.contains("timeout")`, 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/jcode-tui-mermaid/src/mermaid_svg.rs:21 — `trimmed.contains("-.->")` can never decide this `||` — every value satisfying `trimmed.contains("-.->")` also satisfies `trimmed.contains("-.-")`, 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/jcode-tui/src/tui/session_picker/loading.rs:696 — `model.contains("openai-codex")` can never decide this `||` — every value satisfying `model.contains("openai-codex")` also satisfies `model.contains("codex")`, 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/jcode-provider-openrouter-runtime/src/catalog_fetch.rs:291 — `path.ends_with("/v1/models")` can never decide this `||` — every value satisfying `path.ends_with("/v1/models")` also satisfies `path.ends_with("/models")`, 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/jcode-provider-openrouter/src/lib.rs:725 — `lower.contains("kimi-k2.5")` can never decide this `||` — every value satisfying `lower.contains("kimi-k2.5")` also satisfies `lower.contains("kimi-k2")`, 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/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2330 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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/jcode-provider-doctor/src/live_provider_probes.rs:1490 — `outcome.text.contains("REASON_TEST_ANSWER= 4")` can never decide this `||` — every value satisfying `outcome.text.contains("REASON_TEST_ANSWER= 4")` also satisfies `outcome.text.contains("REASON_TEST_ANSWER")`, 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/jcode-provider-core/src/transport.rs:42 — `lower.contains("operation timed out")` can never decide this `||` — every value satisfying `lower.contains("operation timed out")` also satisfies `lower.contains("timed out")`, 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/jcode-provider-core/src/transport.rs:62 — `lower.contains("fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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/jcode-provider-core/src/transport.rs:63 — `lower.contains("fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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/jcode-provider-core/src/transport.rs:64 — `lower.contains("received fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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/jcode-provider-core/src/transport.rs:65 — `lower.contains("received fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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/jcode-provider-anthropic-runtime/src/error_classification.rs:28 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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/jcode-logging/src/lib.rs:619 — `name.starts_with("jcode-desktop-")` can never decide this `||` — every value satisfying `name.starts_with("jcode-desktop-")` also satisfies `name.starts_with("jcode-")`, 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/jcode-logging/src/lib.rs:656 — `key.contains("oauth_code")` can never decide this `||` — every value satisfying `key.contains("oauth_code")` also satisfies `key.contains("auth_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/jcode-compaction-core/src/lib.rs:729 — `lower.contains("request exceeds the maximum size")` can never decide this `||` — every value satisfying `lower.contains("request exceeds the maximum size")` also satisfies `lower.contains("exceeds the maximum size")`, 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/jcode-app-core/src/catchup.rs:446 — `lower.contains("pnpm test")` can never decide this `||` — every value satisfying `lower.contains("pnpm test")` also satisfies `lower.contains("npm test")`, 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×2
  • Silent fallback default in catch REDACTED:123 — `_app_bg_frac` swallows every exception into `return 0.0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch scripts/update_rehearsal.py:91 — `git_short_hash` swallows every exception into `return 'rehearsal'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×2
  • Silent fallback default on parse failure scripts/check_wildcard_reexport_budget.py:63 — `count_wildcards` returns `0` 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/cloud_acceptance_tui.py:123 — `lease` returns `{}` when `(FileNotFoundError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
C4 · Data Retention · Partial data-retention evidence · ×1
  • Partial data-retention evidence — A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 4 of 94 project(s) overshoot their size bounds, lowering Project Cohesion to 9.1/10. The most over is `crates/jcode-tui` (169339 LoC, 314 module-visible types across 20 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
ED3 · Event naming · Event not named in past tense · ×1
  • Event not named in past tense: UpdateStatus crates/jcode-base/src/bus.rs:414 — `UpdateStatus` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name it for the event that occurred (e.g. `ItemAdded`) so the event log records facts.
M2 · Architecture documentation · ADRs not easily discoverable · ×1
  • ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `docs/IOS_APP.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 15/19 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/jcode-harness-api-server`, `crates/jcode-provider-core`, `crates/jcode-sdk`, `packaging/crates-io-placeholder`.
Minor — 43 finding(s)
D12 · Dependency Hygiene · Outdated · ×42
  • Outdated: anyhow — `anyhow` is locked at 1.0.100 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arboard — `arboard` is locked at 3.6.1 but 3.7.0 is the current stable release on crates.io, and it already satisfies the `"3"` requirement declared in crates/jcode-tui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arboard` and commit the updated REDACTED.
  • Outdated: aws-config — `aws-config` is locked at 1.9.0 but 1.13.0 is the current stable release on crates.io, and it already satisfies the `"1.9.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-config` and commit the updated REDACTED.
  • Outdated: aws-credential-types — `aws-credential-types` is locked at 1.3.0 but 1.3.1 is the current stable release on crates.io, and it already satisfies the `"1.3.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-credential-types` and commit the updated REDACTED.
  • Outdated: aws-sdk-bedrock — `aws-sdk-bedrock` is locked at 1.148.0 but 1.164.0 is the current stable release on crates.io, and it already satisfies the `"1.148.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-bedrock` and commit the updated REDACTED.
  • Outdated: aws-sdk-bedrockruntime — `aws-sdk-bedrockruntime` is locked at 1.136.0 but 1.151.0 is the current stable release on crates.io, and it already satisfies the `"1.136.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-bedrockruntime` and commit the updated REDACTED.
  • Outdated: aws-sdk-sts — `aws-sdk-sts` is locked at 1.108.0 but 1.122.0 is the current stable release on crates.io, and it already satisfies the `"1.108.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-sts` and commit the updated REDACTED.
  • Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.6.1 but 1.9.0 is the current stable release on crates.io, and it already satisfies the `"1.6.1"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-types` and commit the updated REDACTED.
  • Outdated: aws-types — `aws-types` is locked at 1.4.0 but 1.7.0 is the current stable release on crates.io, and it already satisfies the `"1.4.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-types` and commit the updated REDACTED.
  • Outdated: azure_core — `azure_core` is locked at 1.0.0 but 1.1.0 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in crates/jcode-azure-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p azure_core` and commit the updated REDACTED.
  • Outdated: bytes — `bytes` is locked at 1.11.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-provider-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytes` and commit the updated REDACTED.
  • Outdated: chrono — `chrono` is locked at 0.4.42 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
  • Outdated: clap — `clap` is locked at 4.6.1 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.8 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-app-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
  • Outdated: futures — `futures` is locked at 0.3.31 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures` and commit the updated REDACTED.
  • Outdated: h2 — `h2` is locked at 0.4.19 but 0.4.20 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in crates/jcode-provider-cursor-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p h2` and commit the updated REDACTED.
  • Outdated: http — `http` is locked at 1.4.0 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-provider-cursor-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http` and commit the updated REDACTED.
  • Outdated: image — `image` is locked at 0.25.9 but 0.25.10 is the current stable release on crates.io, and it already satisfies the `"0.25"` requirement declared in crates/jcode-base/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p image` and commit the updated REDACTED.
  • Outdated: lettre — `lettre` is locked at 0.11.22 but 0.11.23 is the current stable release on crates.io, and it already satisfies the `"0.11.22"` requirement declared in crates/jcode-notify-email/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p lettre` and commit the updated REDACTED.
  • Outdated: libc — `libc` is locked at 0.2.180 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
  • Outdated: memchr — `memchr` is locked at 2.7.6 but 2.8.3 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in crates/jcode-session-types/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p memchr` and commit the updated REDACTED.
  • Outdated: objc2 — `objc2` is locked at 0.6.4 but 0.6.5 is the current stable release on crates.io, and it already satisfies the `"0.6"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p objc2` and commit the updated REDACTED.
  • Outdated: open — `open` is locked at 5.3.3 but 5.4.5 is the current stable release on crates.io, and it already satisfies the `"5"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p open` and commit the updated REDACTED.
  • Outdated: pdf-extract — `pdf-extract` is locked at 0.12.0 but 0.12.1 is the current stable release on crates.io, and it already satisfies the `"0.12"` requirement declared in crates/jcode-pdf/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pdf-extract` and commit the updated REDACTED.
  • Outdated: ratatui — `ratatui` is locked at 0.30.0 but 0.30.2 is the current stable release on crates.io, and it already satisfies the `"0.30"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ratatui` and commit the updated REDACTED.
  • + 17 more in this group — see findings.md.
D10 · Test Quality · Skipped (documented) · ×1
  • Skipped (documented): dashboard stays within a five-term SQLite compound SELECT budget telemetry-worker/test/concurrency.test.mjs:340 — 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-3c681afac20c411b9e4b237fae661f24/history.json --exit-code 0 --source .7artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-3c681afac20c411b9e4b237fae661f24/tree.json --exit-code 0 --source .2artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude sdk/typescript .125artifacts/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-update13artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .0artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17ae4-edae-7df6-972e-bd442853d49d · 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