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

0xPlaygrounds/rig

Measured 14 November 2026, 16:59 UTC, at code version 8c1a2e1

CAI score 72out of 100 Strong
CriticalWeakAdequateStrongExemplary
Up 6 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: 552,986 lines of product code in 61 projects, tests not counted · Estimated rebuild effort: about 6.7 person-years · Weakest lens: Maturity, 69

Findings by how serious they are

25 critical 1171 serious 136 minor

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

This survey was produced by

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

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

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

58of 58 dimensions measured by tools.
1260of 1332 findings point to an exact file and line, so you can open each one in the code. The other 72 concern the repository as a whole, such as missing documentation.
58dimensions across 8 lenses, read from 552,986 lines of product code in 61 projects.
Chapters

Executive summary

0xPlaygrounds/rig meets our standard for a preview release. It scores 72 out of 100 and is rated Strong, and 23 of its 25 critical findings are security problems.

Every lens scores high enough to be rated Strong, so no single lens holds the score back. The best first step is recording design decisions, worth about 3 points. Fixing the part of the code only one person knows comes next, worth about 2 points.

Nineteen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Two secrets can leak from the build pipeline, and one automatic update takes new releases before a bad one can be spotted. Pinning each tool to an exact version, limiting each secret to its own step and setting a waiting period for automatic updates would close these risks. Fixing the weaknesses the scanner points to would fix the security weakness in the code. Moving the business rules into the object that owns the data would take care of the business object that only holds data.

The product code is 552,986 lines, about €980,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.
Maturity 69 · counts for 45%Production Readiness 69 · counts for 25%Code Health 73 · counts for 14%Security and Compliance 75 · counts for 8%Domain Modelling 93 · counts for 4%Architecture 95 · counts for 2%Performance 97 · counts for 1%Event Sourcing 100 · counts for 1%

The weakest lenses score close to each other, so improving any of them moves the score.

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

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

  • Cyclomatic Complexity · rig_cli::run::run_agent (cyclomatic 41) crates/rig-cli/src/run.rs
  • Cyclomatic Complexity · xtask::driver_adoption::mask_literals_and_comments (cyclomatic 37) xtask/src/driver_adoption.rs
  • Cyclomatic Complexity · xtask::driver_adoption::macro_body (cyclomatic 31) xtask/src/driver_adoption.rs
  • Cyclomatic Complexity · rig_acp::translate::replay (cyclomatic 27) plugins/rig-acp/src/translate.rs
  • Cyclomatic Complexity · Stopper::stop (cyclomatic 26) crates/rig-ecs/src/turn.rs
  • Cyclomatic Complexity · rig_tools::watch::send_batches (cyclomatic 23) crates/rig-tools/src/watch.rs
  • Cyclomatic Complexity · Writer::start (cyclomatic 22) crates/rig-markdown/src/markdown.rs
  • Cyclomatic Complexity · xtask::catalog::guard::changes (cyclomatic 21) xtask/src/catalog/guard.rs
  • Cyclomatic Complexity · CacheBook::plan (cyclomatic 20) crates/rig-core/src/providers/gemini/caching.rs
  • Cyclomatic Complexity · rig_basics::reload::rebuild::drain_reload (cyclomatic 20) plugins/rig-basics/src/reload/rebuild.rs
  • Cyclomatic Complexity · xtask::verify::plan::plan (cyclomatic 20) xtask/src/verify/plan.rs
  • Cyclomatic Complexity · Writer::end (cyclomatic 19) crates/rig-markdown/src/markdown.rs
  • Cyclomatic Complexity · PrintPlugin::finish (cyclomatic 19) plugins/rig-basics/src/print.rs
  • Cyclomatic Complexity · Summarizer::serialize (cyclomatic 18) crates/rig-memory/src/compaction.rs
  • Cyclomatic Complexity · rig_basics::subagents::spawn::spawn_requested (cyclomatic 18) plugins/rig-basics/src/subagents/spawn.rs
  • Cyclomatic Complexity · rig_tui::render::draw_choice (cyclomatic 18) plugins/rig-tui/src/render.rs
  • Cyclomatic Complexity · rig_tools::search::find (cyclomatic 17) crates/rig-tools/src/search.rs
  • Cyclomatic Complexity · rig_tui::pick::queue_choices (cyclomatic 17) plugins/rig-tui/src/pick.rs
  • Cyclomatic Complexity · ReplyFold::settle (cyclomatic 16) crates/rig-core/src/operation/completion.rs
  • Cyclomatic Complexity · Serving::serve (cyclomatic 16) crates/rig-core/src/providers/internal/auth/loopback.rs
  • Cyclomatic Complexity · ResponsesDecoder::done (cyclomatic 16) crates/rig-core/src/providers/openai/responses_api/streaming.rs
  • Cyclomatic Complexity · rig_ecs::turn::take_unanswered (cyclomatic 16) crates/rig-ecs/src/turn.rs
  • Cyclomatic Complexity · rig_markdown::wrap::wrap_hanging (cyclomatic 16) crates/rig-markdown/src/wrap.rs
  • Cyclomatic Complexity · rig_acp::session::open (cyclomatic 16) plugins/rig-acp/src/session.rs
  • Cyclomatic Complexity · Options::parse (cyclomatic 16) xtask/src/verify.rs
  • Cyclomatic Complexity · xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs (cyclomatic 16) xtask/src/driver_adoption.rs
  • Cognitive Complexity · rig_cli::run::run_agent (cognitive 93) crates/rig-cli/src/run.rs
  • Cognitive Complexity · xtask::driver_adoption::mask_literals_and_comments (cognitive 86) xtask/src/driver_adoption.rs
  • Cognitive Complexity · rig_acp::translate::replay (cognitive 58) plugins/rig-acp/src/translate.rs
  • Cognitive Complexity · xtask::driver_adoption::macro_body (cognitive 58) xtask/src/driver_adoption.rs
  • Cognitive Complexity · xtask::verify::plan::plan (cognitive 36) xtask/src/verify/plan.rs
  • Cognitive Complexity · rig_markdown::wrap::wrap_hanging (cognitive 31) crates/rig-markdown/src/wrap.rs
  • Cognitive Complexity · Graph::reads (cognitive 31) xtask/src/verify/graph.rs
  • Cognitive Complexity · xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs (cognitive 31) xtask/src/driver_adoption.rs
  • Cognitive Complexity · rig_cli::locks::sweep (cognitive 29) crates/rig-cli/src/locks.rs
  • Cognitive Complexity · Stopper::stop (cognitive 27) crates/rig-ecs/src/turn.rs
  • Cognitive Complexity · xtask::catalog::guard::reviewed_facts (cognitive 27) xtask/src/catalog/guard.rs
  • Cognitive Complexity · rig_markdown::markdown::table::grid (cognitive 26) crates/rig-markdown/src/markdown/table.rs
  • Cognitive Complexity · PrintPlugin::finish (cognitive 25) plugins/rig-basics/src/print.rs
  • Cognitive Complexity · rig_mcp_client::register (cognitive 25) plugins/rig-mcp-client/src/lib.rs
  • Cognitive Complexity · rig_ecs::tools::keep_within_parents (cognitive 24) crates/rig-ecs/src/tools.rs
  • Cognitive Complexity · Serving::serve (cognitive 22) crates/rig-core/src/providers/internal/auth/loopback.rs
  • Cognitive Complexity · SseFramer::push_inner (cognitive 22) crates/rig-http/src/http_client/framing.rs
  • Cognitive Complexity · Runner::run (cognitive 22) plugins/rig-basics/src/helpers.rs
  • Cognitive Complexity · rig_cli::project::manifest (cognitive 21) crates/rig-cli/src/project.rs
  • Cognitive Complexity · CacheBook::plan (cognitive 21) crates/rig-core/src/providers/gemini/caching.rs
  • Cognitive Complexity · rig_mcp_client::unreached (cognitive 21) plugins/rig-mcp-client/src/lib.rs
  • Cognitive Complexity · rig_basics::reload::rebuild::drain_reload (cognitive 20) plugins/rig-basics/src/reload/rebuild.rs
  • Cognitive Complexity · rig_basics::telemetry::usage::usage (cognitive 20) plugins/rig-basics/src/telemetry/usage.rs
  • Cognitive Complexity · xtask::catalog::guard::changes (cognitive 20) xtask/src/catalog/guard.rs
  • Cognitive Complexity · rig_cli::plugin::listing (cognitive 19) crates/rig-cli/src/plugin.rs
  • Cognitive Complexity · rig_memory::rewrite::map_state (cognitive 19) crates/rig-memory/src/rewrite.rs
  • Cognitive Complexity · rig_basics::redact::redact_parts (cognitive 19) plugins/rig-basics/src/redact.rs
  • Cognitive Complexity · corpus_oc::transcript_in_editor::finish (cognitive 18) corpus/oc/src/transcript_in_editor.rs
  • Cognitive Complexity · Writer::end (cognitive 18) crates/rig-markdown/src/markdown.rs
  • Cognitive Complexity · Kept::text (cognitive 18) crates/rig-tools/src/shell.rs
  • Cognitive Complexity · rig_basics::coding_tools::attach (cognitive 18) plugins/rig-basics/src/coding_tools.rs
  • Cognitive Complexity · rig_basics::subagents::spawn::spawn_requested (cognitive 18) plugins/rig-basics/src/subagents/spawn.rs
  • Cognitive Complexity · Resolve::feature (cognitive 18) xtask/src/verify/graph.rs
  • Cognitive Complexity · xtask::catalog::guard::provenance (cognitive 18) xtask/src/catalog/guard.rs
  • Cognitive Complexity · corpus_ct::shell_companion::settled (cognitive 17) corpus/ct/src/shell_companion.rs
  • Cognitive Complexity · rig_cli::run::unfollowed (cognitive 17) crates/rig-cli/src/run.rs
  • Cognitive Complexity · ReplyFold::settle (cognitive 17) crates/rig-core/src/operation/completion.rs
  • Cognitive Complexity · rig_harness_protocol::config::changes (cognitive 17) crates/rig-harness-protocol/src/config.rs
  • Cognitive Complexity · rig_markdown::markdown::table::records (cognitive 17) crates/rig-markdown/src/markdown/table.rs
  • Cognitive Complexity · Secrets::request_once (cognitive 17) plugins/rig-basics/src/redact.rs
  • Cognitive Complexity · rig_tui::render::draw_choice (cognitive 17) plugins/rig-tui/src/render.rs
  • Cognitive Complexity · rig_core::providers::anthropic::completion::repoint_moved_references (cognitive 16) crates/rig-core/src/providers/anthropic/completion.rs
  • Cognitive Complexity · Writer::start (cognitive 16) crates/rig-markdown/src/markdown.rs
  • Cognitive Complexity · rig_reqwest::follow_redirects (cognitive 16) crates/rig-reqwest/src/lib.rs
  • Cognitive Complexity · rig_tools::read::show (cognitive 16) crates/rig-tools/src/read.rs
  • Cognitive Complexity · rig_basics::coding_tools::release (cognitive 16) plugins/rig-basics/src/coding_tools.rs
  • Cognitive Complexity · LookLine::colored (cognitive 16) plugins/rig-tui/src/renderers.rs
  • Cognitive Complexity · Options::parse (cognitive 16) xtask/src/verify.rs
  • Cognitive Complexity · xtask::catalog::guard::compare (cognitive 16) xtask/src/catalog/guard.rs
  • Cognitive Complexity · xtask::catalog::guard::count (cognitive 16) xtask/src/catalog/guard.rs
  • Cognitive Complexity · xtask::verify::run (cognitive 16) xtask/src/verify.rs
  • God Classes · FunctionTooLong: rig_cli::run::run_agent crates/rig-cli/src/run.rs
  • God Classes · FileTooLong: src/lib.rs plugins/rig-mcp-client/src/lib.rs
  • God Classes · FileTooLong: src/run.rs crates/rig-cli/src/run.rs
  • God Classes · FileTooLong: src/router.rs plugins/rig-acp/src/router.rs
  • God Classes · FunctionTooLong: rig_lancedb::utils::deserializer::valid_values crates/rig-lancedb/src/utils/deserializer.rs
  • God Classes · FileTooLong: src/process.rs crates/rig-tools/src/process.rs
  • God Classes · FileTooLong: src/session.rs plugins/rig-acp/src/session.rs
  • God Classes · MethodTooLong: PrintPlugin.finish plugins/rig-basics/src/print.rs
  • God Classes · FunctionTooLong: rig_basics::telemetry::usage::usage plugins/rig-basics/src/telemetry/usage.rs
  • God Classes · FileTooLong: src/driver_adoption.rs xtask/src/driver_adoption.rs
  • God Classes · FileTooLong: catalog/guard.rs xtask/src/catalog/guard.rs
  • God Classes · MethodTooLong: Stopper.stop crates/rig-ecs/src/turn.rs
  • God Classes · FileTooLong: verify/checks.rs xtask/src/verify/checks.rs
  • God Classes · FileTooLong: src/pick.rs plugins/rig-tui/src/pick.rs
  • God Classes · FunctionTooLong: rig_agent::agent::engine::drive_tool_calls crates/rig-agent/src/agent/engine.rs
  • God Classes · FunctionTooLong: rig_acp::session::install plugins/rig-acp/src/session.rs
  • God Classes · FunctionTooLong: rig_tui::render::draw_choice plugins/rig-tui/src/render.rs
  • God Classes · FunctionTooLong: rig_tui::input::read_input plugins/rig-tui/src/input.rs
  • God Classes · FileTooLong: conversation/pairing.rs crates/rig-core/src/conversation/pairing.rs
  • God Classes · MethodTooLong: SqliteVectorStore.add_rows_with_txn crates/rig-sqlite/src/lib.rs
  • God Classes · FileTooLong: src/config.rs crates/rig-harness-protocol/src/config.rs
  • God Classes · FunctionTooLong: rig_acp::router::serve plugins/rig-acp/src/router.rs
  • God Classes · FileTooLong: src/shell.rs crates/rig-tools/src/shell.rs

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

Fixed since the last survey: 165 findings

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

  • Cyclomatic Complexity · xtask::verify::selection::plan (cyclomatic 43) xtask/src/verify/selection.rs
  • Cyclomatic Complexity · rig::launcher::run::launch (cyclomatic 42) src/launcher/run.rs
  • Cyclomatic Complexity · Writer::start (cyclomatic 22) plugins/rig-tui/src/markdown.rs
  • Cyclomatic Complexity · Writer::end (cyclomatic 19) plugins/rig-tui/src/markdown.rs
  • Cyclomatic Complexity · rig::launcher::plugin::add (cyclomatic 17) src/launcher/plugin.rs
  • Cognitive Complexity · rig::launcher::run::launch (cognitive 84) src/launcher/run.rs
  • Cognitive Complexity · xtask::verify::selection::plan (cognitive 70) xtask/src/verify/selection.rs
  • Cognitive Complexity · rig_tui::wrap::wrap (cognitive 27) plugins/rig-tui/src/wrap.rs
  • Cognitive Complexity · rig_tui::markdown::table::grid (cognitive 26) plugins/rig-tui/src/markdown/table.rs
  • Cognitive Complexity · rig::launcher::locks::sweep (cognitive 26) src/launcher/locks.rs
  • Cognitive Complexity · check-dependency-floors.guard_source_paths (cognitive 26) scripts/check-dependency-floors.py
  • Cognitive Complexity · rig_claude_cloak::auth::receive_code (cognitive 25) plugins/rig-claude-cloak/src/auth.rs
  • Cognitive Complexity · HttpExchange::streaming (cognitive 23) crates/rig-core/src/driver/http_transport.rs
  • Cognitive Complexity · rig_core::redact::json_text (cognitive 20) REDACTED
  • Cognitive Complexity · rig_ecs::turn::on_stop_turn (cognitive 20) crates/rig-ecs/src/turn.rs
  • Cognitive Complexity · check-dependency-floors.workspace_direct_deps (cognitive 19) scripts/check-dependency-floors.py
  • Cognitive Complexity · check-dependency-floors.check_floors (cognitive 19) scripts/check-dependency-floors.py
  • Cognitive Complexity · rig_core::tool::schema::plain (cognitive 18) crates/rig-core/src/tool/schema.rs
  • Cognitive Complexity · Writer::end (cognitive 18) plugins/rig-tui/src/markdown.rs
  • Cognitive Complexity · rig_core::providers::chatgpt::auth::native::browser::serve (cognitive 17) REDACTED
  • Cognitive Complexity · rig_basics::subagents::spawn::inherit_settings (cognitive 17) plugins/rig-basics/src/subagents/spawn.rs
  • Cognitive Complexity · rig_tui::markdown::table::records (cognitive 17) plugins/rig-tui/src/markdown/table.rs
  • Cognitive Complexity · rig::launcher::plugin_list::parse (cognitive 17) src/launcher/plugin_list.rs
  • Cognitive Complexity · corpus_oc::git_delta_context::describe (cognitive 16) corpus/oc/src/git_delta_context.rs
  • Cognitive Complexity · rig_basics::compaction::retry_compaction_calls (cognitive 16) plugins/rig-basics/src/compaction.rs
  • Cognitive Complexity · Writer::start (cognitive 16) plugins/rig-tui/src/markdown.rs
  • Cognitive Complexity · rig::launcher::plugin_list::entries (cognitive 16) src/launcher/plugin_list.rs
  • Cognitive Complexity · rig::launcher::plugin_list::parse_string (cognitive 16) src/launcher/plugin_list.rs
  • God Classes · FunctionTooLong: xtask::verify::selection::plan xtask/src/verify/selection.rs
  • God Classes · FunctionTooLong: rig_lancedb::utils::deserializer::type_matcher crates/rig-lancedb/src/utils/deserializer.rs
  • God Classes · FunctionTooLong: rig::launcher::run::launch src/launcher/run.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) corpus/ct/src/schema_adapter/schema.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (13 lines × 2) corpus/oc/src/dataset_cli.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (12 lines × 2) corpus/base/src/custom_provider.rs
  • Code Duplication · Duplicated block (11 lines × 2) crates/rig-core/src/providers/gemini/image_generation.rs
  • Code Duplication · Duplicated block (10 lines × 2) corpus/base/src/check_after_turn.rs
  • Code Duplication · Duplicated block (10 lines × 2) corpus/oc/src/dataset_cli.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/rig-milvus/src/lib.rs
  • Code Duplication · Duplicated block (9 lines × 3) corpus/ho/src/conversation_surgery.rs
  • Code Duplication · Duplicated block (9 lines × 3) crates/rig-qdrant/src/filter.rs
  • Code Duplication · Duplicated block (9 lines × 2) corpus/sn/src/terminal_sessions.rs
  • Code Duplication · Duplicated block (8 lines × 2) corpus/base/src/auto_commit.rs
  • Code Duplication · Duplicated block (8 lines × 2) corpus/base/src/http_api/server.rs
  • Code Duplication · Duplicated block (8 lines × 2) corpus/fh/src/lsp_tools.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/rig-reqwest/src/lib.rs
  • Code Duplication · Duplicated block (7 lines × 2) corpus/ct/src/ask_session_cli.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/rig-core/src/providers/anthropic/streaming.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/rig-core/src/providers/anthropic/streaming.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/rig-core/src/serve/layer.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/oc/src/dataset_cli/dataset.rs
  • Code Duplication · Duplicated block (6 lines × 2) plugins/rig-tui/src/input.rs
  • Code Duplication · Duplicated block (5 lines × 4) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (5 lines × 2) corpus/oc/src/dataset_cli/dataset.rs
  • Code Duplication · Duplicated block (2–5 lines × 3) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/rig-tools/src/edit.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/base/src/background_jobs.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/base/src/cron_agent.rs
  • Code Duplication · Duplicated block (8 lines × 2) corpus/base/src/debate.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/fh/src/import_sessions.rs
  • Code Duplication · Duplicated block (9 lines × 4) crates/rig-agent/src/run/transcript.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/rig-bedrock/src/extension.rs
  • Code Duplication · Duplicated block (9 lines × 2) crates/rig-core/src/completion/request.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/rig-core/src/providers/cohere/embeddings.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/rig-core/src/providers/gemini/extension.rs
  • Code Duplication · Duplicated block (5 lines × 3) crates/rig-tools/src/delete.rs
  • Code Duplication · Duplicated block (8 lines × 3) crates/rig-tools/src/edit.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/rig-tools/src/list.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/rig-core/src/providers/openai/wire/modality.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/base/src/http_api/server.rs
  • Code Duplication · Duplicated block (6 lines × 5) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (6 lines × 2) corpus/base/src/auto_commit.rs
  • Code Duplication · Duplicated block (5 lines × 3) crates/rig-core/src/providers/anthropic/options.rs
  • Code Duplication · Duplicated block (5 lines × 2) corpus/base/src/mcp_client.rs
  • Code Duplication · Duplicated block (5 lines × 2) corpus/base/src/skills.rs
  • Code Duplication · Duplicated block (5 lines × 3) crates/rig-core/src/providers/openai/options.rs
  • Code Duplication · Duplicated block (9 lines × 2) test-support/rig-test-support/src/reasoning.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/rig-agent/src/test_utils/model_conformance.rs
  • Coupling · Off the main sequence: rig-tui
  • Secret Scanning · Leaked secret: aws-access-key REDACTED
  • Secret Scanning · Leaked secret: github-token corpus/base/src/secret_redaction/tests.rs
  • Secret Scanning · Leaked secret: github-token corpus/base/src/secret_redaction/tests.rs
  • Secret Scanning · Leaked secret: hardcoded-credential corpus/base/src/secret_redaction/tests.rs
  • Secret Scanning · Leaked secret: hardcoded-credential crates/rig-cassette/src/http/tests.rs
  • Secret Scanning · Leaked secret: aws-access-key crates/rig-cassette/src/http/tests.rs
  • Secret Scanning · Leaked secret: signing-key crates/rig-cassette/src/http/tests.rs
  • Secret Scanning · Leaked secret: signing-key crates/rig-cassette/src/http/tests.rs
  • Secret Scanning · Leaked secret: signing-key crates/rig-cassette/src/http/tests.rs
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: hardcoded-credential REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: hardcoded-credential REDACTED
  • Secret Scanning · Leaked secret: signing-key REDACTED
  • Secret Scanning · Leaked secret: hardcoded-credential REDACTED
Rebuild cost: about €980,000 · Estimate
Cost to rebuild€330,000 to €1,600,000, for 5,421 to 17,197 hours of work, about 6.7 person-years for 4 to 13 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×1.1 at a score of 72. 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: 552,986 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.
Raises the score by about 3 points · Low effort · ADR Quality
2
Resolve the 1 Off-boarding risk finding(s) in Bus Factor.
Raises the score by about 2 points · Low effort · Bus Factor
3
Resolve the 1 Banned license finding(s) in License Compliance.
Raises the score by about 2 points · Low effort · License Compliance

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.

If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. 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 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort

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 corpus-base corpus-base corpus-shared corpus-shared corpus-base->corpus-shared rig-basics rig-basics corpus-base->rig-basics rig-cassette rig-cassette corpus-base->rig-cassette rig-core rig-core corpus-base->rig-core rig-ecs rig-ecs corpus-base->rig-ecs rig-harness rig-harness corpus-base->rig-harness rig-http rig-http corpus-base->rig-http rig-memory rig-memory corpus-base->rig-memory rig-reqwest rig-reqwest corpus-base->rig-reqwest rig-tools rig-tools corpus-base->rig-tools rig-tui rig-tui corpus-base->rig-tui corpus-fh corpus-fh corpus-fh->corpus-shared corpus-fh->rig-basics corpus-fh->rig-core corpus-fh->rig-harness corpus-fh->rig-memory corpus-fh->rig-tools corpus-fh->rig-tui corpus-ho corpus-ho corpus-ho->corpus-shared corpus-ho->rig-basics corpus-ho->rig-core corpus-ho->rig-harness corpus-ho->rig-memory corpus-ho->rig-tools corpus-ho->rig-tui corpus-library corpus-library corpus-library->rig-core corpus-library->rig-memory corpus-library->rig-tools corpus-oc corpus-oc corpus-oc->corpus-shared corpus-oc->rig-basics corpus-oc->rig-cassette corpus-oc->rig-core corpus-oc->rig-harness corpus-oc->rig-reqwest corpus-oc->rig-tui corpus-rf-06 corpus-rf-06 rig-agent rig-agent corpus-rf-06->rig-agent corpus-rf-06->rig-core corpus-rf-06->rig-memory corpus-shared->rig-basics corpus-shared->rig-core corpus-shared->rig-harness corpus-shared->rig-tools corpus-shared->rig-tui corpus-sn corpus-sn corpus-sn->rig-basics corpus-sn->rig-cassette corpus-sn->rig-core corpus-sn->rig-harness corpus-sn->rig-memory corpus-sn->rig-tools corpus-sn->rig-tui rig rig rig->rig-agent rig->rig-cassette rig->rig-core rig->rig-memory rig->rig-reqwest rig-agent->rig-core rig-agent->rig-memory rig-basics->rig-cassette rig-basics->rig-core rig-basics->rig-ecs rig-basics->rig-harness rig-basics->rig-memory rig-basics->rig-reqwest rig-basics->rig-tools rig-basics->rig-tui rig-cassette->rig-agent rig-cassette->rig-core rig-cassette->rig-memory rig-cassette->rig-reqwest rig-core->rig-http rig-core->rig-reqwest rig-ecs->rig-core rig-ecs->rig-memory rig-harness->rig-core rig-harness->rig-ecs rig-harness->rig-http rig-harness->rig-memory rig-harness->rig-tools rig-memory->rig-core rig-reqwest->rig-http rig-tools->rig-core rig-tui->rig-core rig-tui->rig-ecs rig-tui->rig-harness rig-tui->rig-tools __more__ +41 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.

885 modules, with 3033 dependencies between them. 18 loops run through 152 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 845 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 rig_core.completion.message.native2 rig_core.tool.context3 rig_harness_protocol4 rig_core.completion.provider_options5 rig_core.tool.facts6 rig_http.http_client7 rig_core.completion.request8 rig_http.wasm_compat9 rig_tools.process10 rig_core.completion.message.citation11 rig_http.http_client.erased12 rig_typesafeai.questions13 rig_core.completion.message14 rig_core.catalog.spec15 rig_core.completion.history16 rig_core.conversation17 rig_core.error18 rig_cassette.traffic19 rig_core.catalog.details20 rig_core.effect21 rig_tui.renderers22 rig_core.effect.family23 rig_core.serve.handler24 rig_core.wire25 rig_core.catalog.connector26 rig_core.driver.local27 rig_core.providers.anthropic.wire28 rig_core.driver29 rig_core.providers.openai.wire30 rig_ecs.tasks31 rig_agent.handlers32 rig_core.providers.openai.wire.chat33 rig_agent.agent.hook34 rig_ecs.agent35 rig_harness.services36 rig_agent.agent.completion37 rig_ecs.turn38 rig_harness.host.session39 rig_ecs.stage40 rig_harness.ask
1 rig_core.completion.message.native
2 rig_core.tool.context
3 rig_harness_protocol
4 rig_core.completion.provider_options13
5 rig_core.tool.facts4
6 rig_http.http_client2
7 rig_core.completion.request317
8 rig_http.wasm_compat1
9 rig_tools.process1
10 rig_core.completion.message.citation211
11 rig_http.http_client.erased12
12 rig_typesafeai.questions2
13 rig_core.completion.message11141
14 rig_core.catalog.spec241
15 rig_core.completion.history93110
16 rig_core.conversation5
17 rig_core.error32
18 rig_cassette.traffic233
19 rig_core.catalog.details1
20 rig_core.effect111111
21 rig_tui.renderers21184
22 rig_core.effect.family513
23 rig_core.serve.handler14215
24 rig_core.wire22125231
25 rig_core.catalog.connector4141
26 rig_core.driver.local117
27 rig_core.providers.anthropic.wire211413
28 rig_core.driver22123331
29 rig_core.providers.openai.wire1114
30 rig_ecs.tasks11
31 rig_agent.handlers3111931
32 rig_core.providers.openai.wire.chat2317511632
33 rig_agent.agent.hook266511012
34 rig_ecs.agent112121
35 rig_harness.services1111
36 rig_agent.agent.completion213432
37 rig_ecs.turn4321111149
38 rig_harness.host.session811
39 rig_ecs.stage11118122
40 rig_harness.ask211
Uses a module listed above itPart of a loopThe module itself
1 rig_core.completion.message.native2 rig_core.tool.context3 rig_harness_protocol4 rig_core.completion.provider_options5 rig_core.tool.facts6 rig_http.http_client7 rig_core.completion.request8 rig_http.wasm_compat9 rig_tools.process10 rig_core.completion.message.citation11 rig_http.http_client.erased12 rig_typesafeai.questions13 rig_core.completion.message14 rig_core.catalog.spec15 rig_core.completion.history16 rig_core.conversation17 rig_core.error18 rig_cassette.traffic19 rig_core.catalog.details20 rig_core.effect21 rig_tui.renderers22 rig_core.effect.family23 rig_core.serve.handler24 rig_core.wire25 rig_core.catalog.connector26 rig_core.driver.local27 rig_core.providers.anthropic.wire28 rig_core.driver29 rig_core.providers.openai.wire30 rig_ecs.tasks31 rig_agent.handlers32 rig_core.providers.openai.wire.chat33 rig_agent.agent.hook34 rig_ecs.agent35 rig_harness.services36 rig_agent.agent.completion37 rig_ecs.turn38 rig_harness.host.session39 rig_ecs.stage40 rig_harness.askrig_core.completion.message.native1rig_core.tool.context2rig_harness_protocol3rig_core.completion.provider_options4rig_core.tool.facts5rig_http.http_client6rig_core.completion.request7rig_http.wasm_compat8rig_tools.process9rig_core.completion.message.citation10rig_http.http_client.erased11rig_typesafeai.questions12rig_core.completion.message13rig_core.catalog.spec14rig_core.completion.history15rig_core.conversation16rig_core.error17rig_cassette.traffic18rig_core.catalog.details19rig_core.effect20rig_tui.renderers21rig_core.effect.family22rig_core.serve.handler23rig_core.wire24rig_core.catalog.connector25rig_core.driver.local26rig_core.providers.anthropic.wire27rig_core.driver28rig_core.providers.openai.wire29rig_ecs.tasks30rig_agent.handlers31rig_core.providers.openai.wire.chat32rig_agent.agent.hook33rig_ecs.agent34rig_harness.services35rig_agent.agent.completion36rig_ecs.turn37rig_harness.host.session38rig_ecs.stage39rig_harness.ask4013423171121112211141241931105322331111111211845131421522125231414111721141322123331111411311193123175116322665110121121211111213432432111114981111118122211+845 more modules (most-connected shown)

At a glance — Code Health · 73% · Strong ·

At a glance — Architecture · 95% · Exemplary ·

At a glance — Maturity · 69% · Adequate · gated by M2 ·

At a glance — Readiness · 69% · Adequate · gated by P7 ·

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

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

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

At a glance — Performance · 97% · Exemplary ·

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
A03:2025 — Software Supply Chain Failures46Medium
A05:2025 — Injection24High / Critical
A07:2025 — Authentication Failures1Medium

Roadmap

Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml; Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them; Resolve the 1 Off-boarding risk finding(s) in Bus Factor.

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

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.+2.9 ptsLowADR Quality
Resolve the 1 Off-boarding risk finding(s) in Bus Factor.+2.1 ptsLowBus Factor
Resolve the 1 Banned license finding(s) in License Compliance.+1.5 ptsLowLicense Compliance
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+2.7 ptsMediumArchitecture documentation
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.+1.9 ptsMediumOutbound HTTP resilience
Interpolated log message defeats structured logging+1.5 ptsMediumStructured logging
Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.+1.1 ptsMediumWeb-Security Posture
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml.+0.5 ptsLowPlatform End-of-Life

File quality

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

FileScoreBandWorst signal
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedDependency Vulnerabilities: Medium vulnerability: REDACTED
crates/rig-core/src/completion/request.rs5.9MixedGod Classes: FileTooLong: completion/request.rs
corpus/base/src/todo_tracker.rs6.0MixedExplicit Debt: TodoComment
crates/rig-reqwest/src/lib.rs6.3MixedCognitive Complexity: rig_reqwest::follow_redirects (cognitive 16)
plugins/rig-tui/src/input.rs7.0Near-cleanCyclomatic Complexity: rig_tui::input::act (cyclomatic 50)
crates/rig-agent/src/agent/engine.rs7.0Near-cleanCyclomatic Complexity: StreamingTurnSource::run_model_turn (cyclomatic 48)
plugins/rig-claude-cloak/src/transport.rs7.0Near-cleanCyclomatic Complexity: rig_claude_cloak::transport::body (cyclomatic 44)
plugins/rig-claude-cloak/src/schema.rs7.0Near-cleanCyclomatic Complexity: rig_claude_cloak::schema::upgrade (cyclomatic 39)
crates/rig-cassette/src/scrub.rs7.0Near-cleanCyclomatic Complexity: rig_cassette::scrub::capture_format (cyclomatic 36)
crates/rig-core/src/completion/history.rs7.0Near-cleanCyclomatic Complexity: rig_core::completion::history::user (cyclomatic 32)
crates/rig-core/src/providers/anthropic/completion.rs7.0Near-cleanCyclomatic Complexity: rig_core::providers::anthropic::completion::strict_schema (cyclomatic 32)
crates/rig-ecs/src/turn.rs7.0Near-cleanCyclomatic Complexity: Stopper::stop (cyclomatic 26)
crates/rig-core/src/providers/openai/options.rs7.0Near-cleanCyclomatic Complexity: rig_core::providers::openai::options::chat_options (cyclomatic 22)
crates/rig-core/src/providers/gemini/interactions_api/mod.rs7.0Near-cleanCognitive Complexity: rig_core::providers::gemini::interactions_api::steps (cognitive 28)
crates/rig-core/src/providers/anthropic/wire.rs7.0Near-cleanCode Duplication: Edited copies of one member (3 members, 11+ corresponding lines)
crates/rig-postgres/src/lib.rs7.0Near-cleanCode Duplication: Duplicated block (8 lines × 2)
corpus/fh/src/editor_front.rs7.0Near-cleanCyclomatic Complexity: corpus_fh::editor_front::receive (cyclomatic 32)
corpus/sn/src/vim_input/editor.rs7.0Near-cleanCyclomatic Complexity: corpus_sn::vim_input::editor::parse (cyclomatic 29)

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

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

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

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

Could not be resolved — 20

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

Methodology & how to trust this report

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

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

What we checked — 58 dimensions across the health lenses
D1D2D3D4D5D6D10D12D13D14D15D16D17D19D20D26D28D29D30D31D34D35D43D44AX10AX3AX4AX8AX9C2DM1DM2DM4DM5DM6ES1ES2M1M2M3M4P1P10P2P3P4P6P7P8PF1PF3S1X1X14X21X27X30X4

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1daff-e3bc-7077-be7a-469398506263.

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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 2 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,006 test source file(s) (.rs, .py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .py, .mjs) and this repository declares a Cargo test suite (repository root, 1545 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X13 Undrained process stream — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, 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.
  • X19 Unrestored process-global state — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala or PHP was found in this repository, 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.
  • X22 Contradicted release guard — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and Java, TypeScript/JavaScript, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded, and this repository's Rust 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.
  • X23 Unguarded diagnostic materialisation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin or PHP was found in this repository, 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.
  • X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, 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.
  • X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart and Ruby source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart or Ruby was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go and JavaScript/TypeScript source only, and no C# was loaded and no PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go, JavaScript or TypeScript was found in this repository, 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.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and 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 Rust 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.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • 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 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • 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.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity6.7 / 10Adequate✓ Tool-verified

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

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

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

140 function(s) exceeded the cyclomatic complexity threshold of 15; the worst was rig_tui::input::act at 50. A further 14 function(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 rig_lancedb::utils::deserializer::valid_values at 50 — they are counted neither in the figure above nor in this dimension's score. 8 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/rig-lancedb/src/utils/deserializer.rs (rig_lancedb::utils::deserializer::valid_values at 50), corpus/sn/src/terminal_sessions/keys.rs (corpus_sn::terminal_sessions::keys::named at 32), crates/rig-core/src/catalog/row.rs (Row::without at 32), corpus/sp/src/theme_files.rs (ThemeRole::key at 22), corpus/oc/src/dataset_cli.rs (Options::parse at 20), and 3 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.

rig_core::providers::openai::responses_api::input (cyclomatic 41) · ×15crates/rig-core/src/providers/openai/responses_api/mod.rs:142
xtask::verify::execute::internal (cyclomatic 40) · ×10xtask/src/verify/execute.rs:40
rig_tui::input::act (cyclomatic 50) · ×7plugins/rig-tui/src/input.rs:708
corpus_sn::vim_input::editor::parse (cyclomatic 29) · ×7corpus/sn/src/vim_input/editor.rs:409
rig_claude_cloak::transport::body (cyclomatic 44) · ×6plugins/rig-claude-cloak/src/transport.rs:625

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

What to do

  1. Bring the 15 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with rig_tui::input::act (cyclomatic 50), StreamingTurnSource::run_model_turn (cyclomatic 48), rig_claude_cloak::transport::body (cyclomatic 44). — 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 15 together lifts Cyclomatic Complexity from 6.7 to about 7.3/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.

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

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

330 function(s) exceeded the cognitive complexity threshold of 15; the worst was StreamingTurnSource::run_model_turn at 132.

rig_core::providers::openai::responses_api::input (cognitive 92) · ×25crates/rig-core/src/providers/openai/responses_api/mod.rs:142
xtask::driver_adoption::mask_literals_and_comments (cognitive 86) · ×25xtask/src/driver_adoption.rs:65
corpus_sn::crash_resume::recover (cognitive 35) · ×18corpus/sn/src/crash_resume.rs:207
corpus_oc::transcript_in_editor::rebuild (cognitive 48) · ×17corpus/oc/src/transcript_in_editor.rs:492
corpus_fh::editor_front::receive (cognitive 72) · ×16corpus/fh/src/editor_front.rs:542

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

What to do

  1. Bring the 1 body over 120 down to 120 or less in Cognitive Complexity — start with StreamingTurnSource::run_model_turn (cognitive 132). — Refactoring it lifts Cognitive Complexity from 5.7 to about 5.8/10.

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

D3 · God Classes9.1 / 10Stronggated by 142 serious findings✓ 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 9.1 / 10 · rule-coverage 100% · ceiling Prevented

142 god class(es) detected.

FileTooLong: src/scrub.rs · ×84crates/rig-cassette/src/scrub.rs
FunctionTooLong: xtask::verify::checks::all · ×32xtask/src/verify/checks.rs:104
MethodTooLong: StreamingTurnSource.run_model_turn · ×9crates/rig-agent/src/agent/engine.rs:865
TooManyMethods: AgentRun · ×9crates/rig-agent/src/run/mod.rs:309
ClassTooLong: Scrubber · ×7crates/rig-cassette/src/scrub.rs:182

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

What to do

  1. Resolve the 84 FileTooLong finding(s) in God Classes — start with mod.rs (5), lib.rs (4), completion.rs (3). — One of this dimension's main actionable groups (84 warning-level).
  2. Resolve the 32 FunctionTooLong finding(s) in God Classes — start with transport.rs (2), mod.rs (2), render.rs (2). — One of this dimension's main actionable groups (32 warning-level).
  3. Resolve the 9 MethodTooLong finding(s) in God Classes — start with mod.rs (2), engine.rs, caching.rs. — One of this dimension's main actionable groups (9 warning-level).

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

D4 · Code Duplication9.5 / 10Stronggated by 346 serious findings✓ Tool-verified

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

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

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

151 duplicated block group(s) detected. 1.3 % of the production lines (6,989 of 552,986) are in a reported copy. A further 195 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 35 of the 346 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 (6 lines × 2) · ×28corpus/base/src/pinned_notes.rs:86
Duplicated block (8 lines × 2) · ×19corpus/base/src/auto_commit.rs:235
Edited copy of a member (7 corresponding lines) · ×17plugins/rig-basics/src/session_picker.rs:155
Duplicated block (7 lines × 2) · ×17corpus/base/src/share/render.rs:124
Duplicated block (5 lines × 2) · ×17corpus/base/src/format_on_write.rs:291

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

What to do

  1. Resolve the 28 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with scrub.rs (2), skills.rs (2), render.rs (2). — One of this dimension's main actionable groups (28 warning-level).
  2. Resolve the 19 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with options.rs (2), chat.rs (2), auto_commit.rs. — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 17 Edited copy of a member (7 corresponding lines) finding(s) in Code Duplication — start with session_picker.rs, custom_provider.rs, review_agent.rs. — One of this dimension's main actionable groups (17 warning-level).

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

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

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

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

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

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

61 production modules (Cargo), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 8 module(s) off the main sequence, with abstractness counted on 60 of the 61 (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: rig-harness-protocol · ×8

What to do

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

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

D6 · Cohesion (LCOM4)9.9 / 10Stronggated by 8 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

8 of 848 classes have LCOM4 above 3.

Low cohesion: ModelSpec (LCOM4 7) · ×8crates/rig-core/src/catalog/spec.rs:44

What to do

  1. Resolve the 8 Low cohesion finding(s) in Cohesion (LCOM4) — start with wire.rs (3), spec.rs, request.rs. — One of this dimension's main actionable groups (8 warning-level).

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

D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md.

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

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

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

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

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

Outdated: aws-config · ×41

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

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

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

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

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

Secret scan ran and found no leaked secrets. 1 AWS access key ID(s) with no secret access key beside them are listed to check and are not counted as leaked: the key ID alone signs nothing.

REDACTED

✓ On the Gold path — maintain.

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

D14 · License Compliance8.0 / 10Adequategated by 1 critical finding✓ Tool-verified

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 8.0 / 10 · rule-coverage 100% · ceiling Verified

1 of 1514 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT, which is its own choice and is not judged here.

Banned license: epub

What to do

  1. Resolve the 1 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (1 issue-level).

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

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

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

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

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

Top hotspots: crates/rig-agent/src/agent/engine.rs (44×48=2112); crates/rig-core/src/providers/openai/responses_api/mod.rs (46×41=1886); crates/rig-core/src/providers/anthropic/completion.rs (45×32=1440) Repeated repair below the complexity floor: crates/rig-ecs/src/lib.rs (15 of 25 changes were fixes); plugins/rig-tui/src/lib.rs (11 of 21 changes were fixes); crates/rig-tools/src/workspace.rs (11 of 16 changes were fixes)

Hotspot: crates/rig-agent/src/agent/engine.rs · ×63crates/rig-agent/src/agent/engine.rs:865
Repeated repair: crates/rig-ecs/src/lib.rs · ×53crates/rig-ecs/src/lib.rs:178

What to do

  1. Resolve the 63 Hotspot finding(s) in Churn × Complexity Hotspots — start with streaming.rs (5), mod.rs (3), completion.rs (2). — One of this dimension's main actionable groups (63 warning-level).
  2. Resolve the 53 Repeated repair finding(s) in Churn × Complexity Hotspots — start with lib.rs (4), remote.rs (2), tools.rs (2). — One of this dimension's main actionable groups (53 warning-level).

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

D16 · Bus Factor5.1 / 10Adequate✓ Tool-verified

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

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

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

672 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is crates/rig-agent/src/agent/engine/tests.rs. Counted over 1383 of the 1592 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1

What to do

  1. Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

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

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

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

1 deducted task-comment markers across 552986 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.

TodoCommentcorpus/base/src/todo_tracker.rs:1

What to do

  1. Resolve the 1 TodoComment finding(s) in Explicit Debt — start with todo_tracker.rs. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

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

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

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

No architecture decision records were found.

No ADRs foundcrates/rig-cli/Cargo.toml:16

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — One of this dimension's main actionable groups (1 recommendation-level).

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

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

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

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

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

11 of 61 build units (Cargo) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

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

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

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

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

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

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

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

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

24 finding(s): 0 critical, 23 high, 1 medium, 0 low. 18 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 23 file(s) — `corpus/base/src/effect_query/query.rs` (line 241, line 242), `corpus/base/src/session_replay.rs` (line 896), `corpus/ct/src/history_versions.rs` (line 355, line 356, line 357), `corpus/ct/src/shell_companion/snippet/bash.sh` (line 21), `corpus/ct/src/shell_companion/snippet/zsh.sh` (lines 12–42), … (+18 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.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. 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).
  2. Resolve the 1 REDACTED finding(s) charged to Static Analysis (SAST) — the other 18 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (19 issue-level, 1 of them charged here).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

D30 · Dependency Vulnerabilities1.4 / 10Critical✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 16 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (16). — One of this dimension's main actionable groups (16 warning-level).
  2. Resolve the 14 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (14). — One of this dimension's main actionable groups (14 warning-level).
  3. Resolve the 13 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (13). — One of this dimension's main actionable groups (13 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

1 of 1383 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/rig-vectorize/src/client/types.rs. Counted over 1383 of the 1592 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge
Orphaned filecrates/rig-vectorize/src/client/types.rs:1

✓ On the Gold path — maintain.

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

D35 · Change Coupling9.9 / 10Stronggated by 6 serious findings✓ Tool-verified

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

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

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

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

Strongest change-coupling: lib.rs↔lib.rs 69%; lib.rs↔lib.rs 69%; lib.rs↔lib.rs 62%

Change coupling: lib.rs ↔ lib.rs · ×5crates/rig-postgres/src/lib.rs:1
Change-coupling hub: lib.rs → lib.rs, lib.rs, lib.rscrates/rig-mongodb/src/lib.rs

What to do

  1. Resolve the 5 Change coupling finding(s) in Change Coupling — start with lib.rs (3), mod.rs (2). — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with lib.rs. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life6.0 / 10Adequate✓ Tool-verified

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

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

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

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

End-of-life runtime: Rust 1.97rust-toolchain.toml:1

What to do

  1. Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml. — One of this dimension's main actionable groups (1 warning-level).

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

Frontend & cross-cutting dimensions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

DM1 · Aggregate boundaries10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether an aggregate references another aggregate by identity rather than embedding it by object reference.

Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.

Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.

DM2 · Strongly-typed ids10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

What to do

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

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

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

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

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

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (diesel/sea-orm/sqlx) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

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

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

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)9.6 / 10Exemplary✓ Tool-verified

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

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

M2 · Architecture documentation2.0 / 10Weak✓ 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.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

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

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

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

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

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

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

P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified

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

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

  • 2 public types in `rig_agent.integrations.cli_chatbot` are marked as implementation by their own namespace, folder or name: `ChatImpl` (crates/rig-agent/src/integrations/cli_chatbot.rs:52, name ends in `Impl`), `AgentImpl` (crates/rig-agent/src/integrations/cli_chatbot.rs:57, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — crates/rig-agent/src/integrations/cli_chatbot.rs:52
  • 4 public types in `rig_core.providers.internal.auth` are marked as implementation by their own namespace, folder or name: `DeviceCodePrompt` (crates/rig-core/src/providers/internal/auth.rs:17, `internal`), `DeviceCodeHandler` (crates/rig-core/src/providers/internal/auth.rs:33, `internal`), `AuthError` (crates/rig-core/src/providers/internal/auth.rs:68, `internal`), `AuthContext` (crates/rig-core/src/providers/internal/auth.rs:98, `internal`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — crates/rig-core/src/providers/internal/auth.rs:17
  • 5 public types in `rig_core.providers.internal.auth.loopback` are marked as implementation by their own namespace, folder or name: `LoopbackHost` (crates/rig-core/src/providers/internal/auth/loopback.rs:41, `internal`), `LoopbackError` (crates/rig-core/src/providers/internal/auth/loopback.rs:51, `internal`), `Loopback` (crates/rig-core/src/providers/internal/auth/loopback.rs:74, `internal`), `Listener` (crates/rig-core/src/providers/internal/auth/loopback.rs:200, `internal`), `Received` (crates/rig-core/src/providers/internal/auth/loopback.rs:228, `internal`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — crates/rig-core/src/providers/internal/auth/loopback.rs:41
  • 1 public type in `rig_core.providers.internal` is marked as implementation by its own namespace, folder or name: `LogTarget` (crates/rig-core/src/providers/internal/mod.rs:97, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/rig-core/src/providers/internal/mod.rs:97
  • 1 public type in `rig_core.providers.internal.wire_ids` is marked as implementation by its own namespace, folder or name: `WireIds` (crates/rig-core/src/providers/internal/wire_ids.rs:16, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/rig-core/src/providers/internal/wire_ids.rs:16

What to do

  • Hide `rig_agent.integrations.cli_chatbot` (`ChatImpl`, `AgentImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `rig_core.providers.internal.auth` (`DeviceCodePrompt`, `DeviceCodeHandler`, `AuthError`, `AuthContext`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `rig_core.providers.internal.auth.loopback` (`LoopbackHost`, `LoopbackError`, `Loopback`, `Listener`, `Received`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `rig_core.providers.internal` (`LogTarget`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `rig_core.providers.internal.wire_ids` (`WireIds`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability9.0 / 10Exemplary✓ 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 23/34 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `corpus/ct`, `corpus/library`, `corpus/rf-01`, `corpus/rf-06`, `corpus/rf-07` and 6 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling8.0 / 10Strong✓ Tool-verified

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

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

  • `REDACTED` schedules updates, but no `package-ecosystem` entry covers `github-actions`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:2

What to do

  • Dependabot is configured but does not watch `github-actions` — add that `package-ecosystem` entry to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

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

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

P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

  • `AgentBuilder::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×3) — corpus/rf-01/src/main.rs:22, corpus/rf-06/src/lib.rs:271, crates/rig-agent/src/extractor.rs:118
  • `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×5) — crates/rig-cassette/src/http/ledger.rs:521, crates/rig-cassette/src/http/paths.rs:235, crates/rig-cassette/src/http/proxy.rs:249, …
  • `Client::builder()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — crates/rig-helixdb/src/lib.rs:69
  • `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — crates/rig-milvus/src/lib.rs:105
  • `Client::new()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — crates/rig-vectorize/src/client/mod.rs:75

What to do

  • Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

S1 · Web-Security Posture6.0 / 10Adequate✓ Tool-verified

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

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

  • This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (crates/rig-cassette/src/http/mod.rs:1252).
  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (crates/rig-cassette/src/http/mod.rs:1252).

What to do

  • Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.
  • Set security response headers on what the server sends — actix-web's `DefaultHeaders::new().add((header::X_CONTENT_TYPE_OPTIONS, "nosniff"))`, tower-http's `SetResponseHeaderLayer::overriding(…)` on an axum router, or keep Rocket's default `Shield` — with `Content-Security-Policy`, `X-Content-Type-Options` and a frame policy on every response.
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.

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.

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.

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.

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.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

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

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

X4 · Structured logging4.4 / 10Weak✓ Tool-verified

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

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

  • `debug!` at line 266 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-vertexai/src/completion.rs:266
  • `debug!` at line 174 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-vectorize/src/lib.rs:174
  • `debug!` at line 26 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-vectorize/src/client/mod.rs:26
  • `debug!` at line 113 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-vectorize/src/client/mod.rs:113
  • `info!` at line 583 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:583
  • `debug!` at line 637 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:637
  • `debug!` at line 687 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:687
  • `debug!` at line 2028 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2028
  • `debug!` at line 2063 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2063
  • `debug!` at line 2075 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2075
  • `debug!` at line 2081 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2081
  • `debug!` at line 2089 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2089
  • `debug!` at line 2106 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-sqlite/src/lib.rs:2106
  • `error!` at line 258 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-rmcp/src/handler.rs:258
  • `warn!` at line 163 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-reqwest/src/lib.rs:163
  • `info!` at line 259 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/lib.rs:259
  • `warn!` at line 333 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/lib.rs:333
  • `info!` at line 390 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/lib.rs:390
  • `warn!` at line 428 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/lib.rs:428
  • `info!` at line 434 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/lib.rs:434
  • `debug!` at line 171 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-neo4j/src/vector_index.rs:171
  • `info!` at line 237 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-mongodb/src/lib.rs:237
  • `info!` at line 207 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/vector_store/in_memory_store.rs:207
  • `warn!` at line 270 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/providers/openai/wire/chat.rs:270
  • `trace!` at line 111 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/providers/internal/mod.rs:111
  • `trace!` at line 100 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/providers/gemini/embedding.rs:100
  • `trace!` at line 68 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/providers/gemini/transcription.rs:68
  • `warn!` at line 551 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/completion/options/merge.rs:551
  • `warn!` at line 716 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-core/src/completion/options/merge.rs:716
  • `warn!` at line 604 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-cassette/src/traffic.rs:604
  • `warn!` at line 631 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-agent/src/tool/server.rs:631
  • `info!` at line 249 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-agent/src/integrations/cli_chatbot.rs:249
  • `info!` at line 286 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-agent/src/agent/engine.rs:286
  • `debug!` at line 166 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-agent/src/agent/typed.rs:166
  • `warn!` at line 192 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/rig-agent/src/agent/typed.rs:192

What to do

  • Interpolated log message defeats structured logging

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 Health73%StrongSolid.
Architecture95%ExemplarySolid.
Maturity69%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness69%Adequate — gated by P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security75%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling93%ExemplarySolid.
Event Sourcing100%ExemplaryStrongest area.
Performance97%ExemplarySolid.
Unscored — 5 check(s) recorded observations but carry no score

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

  • AXH1 Runtime security headers — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility (rendered) — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXS1 Runtime exposed surface — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X10 Duplicated predicate — 21 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 23 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

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

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 64 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not 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; 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.
  • 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. 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
  • AX6 Interface segregation — no exported interface declares behaviour
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXA1 Runtime unauthenticated reachability — This run crawled public routes only — it had no logged-in session, so there is no authenticated surface to compare anonymous access against and nothing was measured. This is a statement about this run, not about your application: nothing here says access control is missing, and nothing here says it is present.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXI1 Runtime container hardening — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — N/A — too few peers to establish a naming convention (53360 declarations, no unit with a dominant convention).
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (rig-core), 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#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
  • D25 ADR Conformance — no ADRs to check
  • 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.
  • D36 Supply-chain Provenance & Signing — The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files).
  • 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.
  • 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.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — Rust suite
  • DM3 Integration-event coupling — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • DM7 Repository granularity — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and 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'.
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • X12 Unreachable branch — 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
  • X13 Undrained process stream — 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
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not 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
  • X17 Uncapped recursion over a caller-supplied document — 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
  • X18 Disposal-pattern correctness — 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
  • X19 Unrestored process-global state — 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
  • X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • 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.
  • X22 Contradicted release guard — 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
  • X23 Unguarded diagnostic materialisation — 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
  • X24 Document value interpolated into markup unescaped — 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
  • X25 Inert configuration knob — 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
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. Not a gap in the analyzer and not a finding about your code.
  • X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — 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
  • 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.
  • 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.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 25 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
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D14 · License Compliance · Banned license · ×1
  • Banned license: epub — `epub` 2.1.6 is published on crates.io under `GPL-3.0-or-later`, which this policy bans, and it is in the SHIPPED closure of this repository's REDACTED — so it is compiled by everything that builds this repository, not just by its test harness. The expression was read as SPDX, not as text: an `OR` is a choice and is only charged when every branch is banned, while an `AND` binds you to both operands and is charged when either is. Replace the crate, or record an accepted exception.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
DM4 · Rich vs anemic domain model · Anemic domain model · ×1
  • Anemic domain model: DeviceCodePrompt crates/rig-core/src/providers/internal/auth.rs:17 — `DeviceCodePrompt` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside.
Serious — 1171 finding(s)
D3 · God Classes · FileTooLong · ×84
  • FileTooLong: src/scrub.rs crates/rig-cassette/src/scrub.rs — FileTooLong — 2174 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 62 free functions. The bar is 500 significant lines; this is 1674 over it, 4.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: http/mod.rs crates/rig-cassette/src/http/mod.rs — FileTooLong — 2160 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 88 free functions. The bar is 500 significant lines; this is 1660 over it, 4.32× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs crates/rig-sqlite/src/lib.rs — FileTooLong — 1309 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 809 over it, 2.62× 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/compaction.rs plugins/rig-basics/src/compaction.rs — FileTooLong — 1271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 40 free functions. The bar is 500 significant lines; this is 771 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: wire/chat.rs crates/rig-core/src/providers/openai/wire/chat.rs — FileTooLong — 1216 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 716 over it, 2.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/turn.rs crates/rig-ecs/src/turn.rs — FileTooLong — 1204 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 704 over it, 2.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/print.rs plugins/rig-basics/src/print.rs — FileTooLong — 1148 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 648 over it, 2.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: agent/engine.rs crates/rig-agent/src/agent/engine.rs — FileTooLong — 1113 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 613 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/transcript.rs plugins/rig-tui/src/transcript.rs — FileTooLong — 1109 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 609 over it, 2.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: completion/history.rs crates/rig-core/src/completion/history.rs — FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 34 free functions. The bar is 500 significant lines; this is 551 over it, 2.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: run/mod.rs crates/rig-agent/src/run/mod.rs — FileTooLong — 1045 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 80% of them inside a single declaration: AgentRun (4 blocks, 309-1870). The bar is 500 significant lines; this is 545 over it, 2.09× 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: openai/options.rs crates/rig-core/src/providers/openai/options.rs — FileTooLong — 1028 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 68 free functions. The bar is 500 significant lines; this is 528 over it, 2.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: src/render.rs plugins/rig-tui/src/render.rs — FileTooLong — 1025 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 525 over it, 2.05× 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: operation/completion.rs crates/rig-core/src/operation/completion.rs — FileTooLong — 999 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 499 over it, 2.00× 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: wire/modality.rs crates/rig-core/src/providers/openai/wire/modality.rs — FileTooLong — 943 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 443 over it, 1.89× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: completion/request.rs crates/rig-core/src/completion/request.rs — FileTooLong — 922 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 422 over it, 1.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/stage.rs crates/rig-ecs/src/stage.rs — FileTooLong — 920 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 420 over it, 1.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: anthropic/completion.rs crates/rig-core/src/providers/anthropic/completion.rs — FileTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 42 free functions. The bar is 500 significant lines; this is 419 over it, 1.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/open_pr.rs corpus/fh/src/open_pr.rs — FileTooLong — 880 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 380 over it, 1.76× 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/compaction.rs crates/rig-memory/src/compaction.rs — FileTooLong — 877 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 377 over it, 1.75× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: completion/message.rs crates/rig-core/src/completion/message.rs — FileTooLong — 872 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 372 over it, 1.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: src/lib.rs plugins/rig-mcp-client/src/lib.rs — FileTooLong — 872 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 372 over it, 1.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: src/transport.rs plugins/rig-claude-cloak/src/transport.rs — FileTooLong — 849 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 349 over it, 1.70× 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/rig-harness-protocol/src/lib.rs — FileTooLong — 813 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 313 over it, 1.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: src/run.rs crates/rig-cli/src/run.rs — FileTooLong — 796 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 296 over it, 1.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 59 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×63
  • Hotspot: crates/rig-agent/src/agent/engine.rs crates/rig-agent/src/agent/engine.rs:865 — crates/rig-agent/src/agent/engine.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in StreamingTurnSource::run_model_turn at line 865. 12 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-agent/src/agent/engine.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-core/src/providers/openai/responses_api/mod.rs crates/rig-core/src/providers/openai/responses_api/mod.rs:142 — crates/rig-core/src/providers/openai/responses_api/mod.rs changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in rig_core::providers::openai::responses_api::input at line 142. 7 of those changes were fix/bug commits, and the other 39 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/openai/responses_api/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-core/src/providers/anthropic/completion.rs crates/rig-core/src/providers/anthropic/completion.rs:1356 — crates/rig-core/src/providers/anthropic/completion.rs changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in rig_core::providers::anthropic::completion::strict_schema at line 1356. 8 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/anthropic/completion.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/rig-cli/src/run.rs crates/rig-cli/src/run.rs:281 — crates/rig-cli/src/run.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in rig_cli::run::run_agent at line 281. 13 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-cli/src/run.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/rig-agent/src/run/mod.rs crates/rig-agent/src/run/mod.rs:879 — crates/rig-agent/src/run/mod.rs changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in AgentRun::next_step at line 879. 10 of those changes were fix/bug commits, and the other 31 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-agent/src/run/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-core/src/providers/openai/wire/chat.rs crates/rig-core/src/providers/openai/wire/chat.rs:388 — crates/rig-core/src/providers/openai/wire/chat.rs changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in Chat::assistant at line 388. 11 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/openai/wire/chat.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: plugins/rig-basics/src/print.rs plugins/rig-basics/src/print.rs:709 — plugins/rig-basics/src/print.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in rig_basics::print::drive at line 709. 18 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/print.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/rig-ecs/src/turn.rs crates/rig-ecs/src/turn.rs:674 — crates/rig-ecs/src/turn.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Stopper::stop at line 674. 14 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/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/rig-core/src/providers/gemini/streaming.rs crates/rig-core/src/providers/gemini/streaming.rs:93 — crates/rig-core/src/providers/gemini/streaming.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in GenerateContentDecoder::decode at line 93. 5 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/gemini/streaming.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: plugins/rig-basics/src/compaction.rs plugins/rig-basics/src/compaction.rs:1234 — plugins/rig-basics/src/compaction.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in rig_basics::compaction::compact_near_the_window at line 1234. 9 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/compaction.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/rig-core/src/providers/openai/responses_api/streaming.rs crates/rig-core/src/providers/openai/responses_api/streaming.rs:607 — crates/rig-core/src/providers/openai/responses_api/streaming.rs changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in ResponsesDecoder::done at line 607. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/openai/responses_api/streaming.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-core/src/providers/gemini/interactions_api/streaming.rs crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:282 — crates/rig-core/src/providers/gemini/interactions_api/streaming.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in InteractionsDecoder::delta at line 282. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/gemini/interactions_api/streaming.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-core/src/operation/completion.rs crates/rig-core/src/operation/completion.rs:750 — crates/rig-core/src/operation/completion.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in ReplyFold::settle at line 750. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/operation/completion.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/rig-core/src/providers/deepseek.rs crates/rig-core/src/providers/deepseek.rs:213 — crates/rig-core/src/providers/deepseek.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in rig_core::providers::deepseek::strict_node at line 213. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/providers/deepseek.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: plugins/rig-tui/src/transcript.rs plugins/rig-tui/src/transcript.rs:1519 — plugins/rig-tui/src/transcript.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in rig_tui::transcript::message_lines at line 1519. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-tui/src/transcript.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: xtask/src/verify/execute.rs xtask/src/verify/execute.rs:40 — xtask/src/verify/execute.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in xtask::verify::execute::internal at line 40. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- xtask/src/verify/execute.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/rig-core/src/completion/history.rs crates/rig-core/src/completion/history.rs:1553 — crates/rig-core/src/completion/history.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in rig_core::completion::history::user at line 1553. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/completion/history.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/rig-bedrock/src/streaming.rs crates/rig-bedrock/src/streaming.rs:141 — crates/rig-bedrock/src/streaming.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in StreamState::delta at line 141. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-bedrock/src/streaming.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: plugins/rig-tui/src/render.rs plugins/rig-tui/src/render.rs:653 — plugins/rig-tui/src/render.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in rig_tui::render::lay_out_transcript at line 653. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-tui/src/render.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: plugins/rig-tui/src/input.rs plugins/rig-tui/src/input.rs:708 — plugins/rig-tui/src/input.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in rig_tui::input::act at line 708. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-tui/src/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/rig-core/src/serve/handler.rs crates/rig-core/src/serve/handler.rs:516 — crates/rig-core/src/serve/handler.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in Reply::observed at line 516. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-core/src/serve/handler.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/rig-agent/src/test_utils/model_conformance.rs crates/rig-agent/src/test_utils/model_conformance.rs:1380 — crates/rig-agent/src/test_utils/model_conformance.rs changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in rig_agent::test_utils::model_conformance::invalid_tool_recovery_with_choice at line 1380. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-agent/src/test_utils/model_conformance.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/rig-candle/src/protocol.rs crates/rig-candle/src/protocol.rs:518 — crates/rig-candle/src/protocol.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in rig_candle::protocol::render_qwen_message at line 518. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-candle/src/protocol.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/rig-agent/src/run/prepare.rs crates/rig-agent/src/run/prepare.rs:126 — crates/rig-agent/src/run/prepare.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in rig_agent::run::prepare::prepare_request at line 126. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-agent/src/run/prepare.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/rig-ecs/src/stage.rs crates/rig-ecs/src/stage.rs:1186 — crates/rig-ecs/src/stage.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in rig_ecs::stage::start at line 1186. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/stage.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.
  • + 38 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×53
  • Repeated repair: crates/rig-ecs/src/lib.rs crates/rig-ecs/src/lib.rs:178 — crates/rig-ecs/src/lib.rs changed 25 times in last 90 days and 15 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is AgentPlugin::build at line 178), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(print): rig --json writes ready before answering a request already waiting (#3216)”; “fix(usage,budget)!: model calls ended by a stop count toward spend and the budget (#3003)”; “fix!: every limit on asked work is a settings.toml key with a sensible default, and rig says what it changes (#2995)”; “fix(redact): a notice is redacted between the stages, before any front reads it (#2993)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/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: plugins/rig-tui/src/lib.rs plugins/rig-tui/src/lib.rs:202 — plugins/rig-tui/src/lib.rs changed 21 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is TuiViewPlugin::finish at line 202), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tui): the wheel scrolls the transcript and a drag copies the text under it (#3104)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(harness)!: one run contract for every front; unknown input is refused out loud (#2972)”; “fix(harness)!: one current agent per session; a fork says what it copies (#2967)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-tui/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/rig-tools/src/workspace.rs crates/rig-tools/src/workspace.rs:512 — crates/rig-tools/src/workspace.rs changed 16 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is rig_tools::workspace::read_file at line 512), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tools): a move between hard links is refused, and git checkpoints keep raw bytes per root (#3043)”; “fix(tools,memory)!: a confined write never leaves its base, and a stale session save is refused (#2999)”; “fix(tools)!: an @ reference attaches exactly the file that was picked (#2962)”; “fix(tools)!: tool results show what they found (#2965)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/workspace.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/rig-tools/src/remote.rs crates/rig-tools/src/remote.rs:513 — crates/rig-tools/src/remote.rs changed 15 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is Remote::read_files at line 513), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tools): remote writes refuse links, say a later mismatch proves nothing, and git listings hold only files there (#3041)”; “fix(tools)!: every child process has one owner, enforced by a lint (#2970)”; “fix(tools)!: an @ reference attaches exactly the file that was picked (#2962)”; “fix(tools)!: tool results show what they found (#2965)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/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.
  • Repeated repair: crates/rig-ecs/src/agent.rs crates/rig-ecs/src/agent.rs:570 — crates/rig-ecs/src/agent.rs changed 14 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is Partial::follow at line 570), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(tools)!: --tools limits only the run it is given to (#2984)”; “fix(harness)!: one run contract for every front; unknown input is refused out loud (#2972)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/agent.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/rig-ecs/src/tools.rs crates/rig-ecs/src/tools.rs:481 — crates/rig-ecs/src/tools.rs changed 15 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is rig_ecs::tools::keep_within_parents at line 481), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix!: every limit on asked work is a settings.toml key with a sensible default, and rig says what it changes (#2995)”; “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(tools)!: --tools limits only the run it is given to (#2984)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/tools.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/rig-harness/src/host/launcher.rs crates/rig-harness/src/host/launcher.rs:427 — crates/rig-harness/src/host/launcher.rs changed 14 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 8 (its worst body is rig_harness::host::launcher::launcher_notice at line 427), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-harness): move a process-group list a reload cannot read aside instead of writing over it (#3263)”; “fix(rig-harness): keep each launcher warning whole when it holds a line break (#3258)”; “fix(rig-cli): `rig plugin check --build` refuses settings a start would refuse (#3253)”; “fix!: every limit on asked work is a settings.toml key with a sensible default, and rig says what it changes (#2995)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-harness/src/host/launcher.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/rig-tools/src/read.rs crates/rig-tools/src/read.rs:352 — crates/rig-tools/src/read.rs changed 13 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is rig_tools::read::show at line 352), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix!: every limit on asked work is a settings.toml key with a sensible default, and rig says what it changes (#2995)”; “fix(tools)!: tool results show what they found (#2965)”; “fix(tools)!: read returns images, long lines can be read on, a clearer timeout hint (#2913)”; “fix(rig-tools)!: triobench round 8: a read of part of a small remote file gets it whole so an edit after it is one call, an edit's reply shows the changed lines and a few around them (#2860)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/read.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: plugins/rig-mcp-client/src/lib.rs plugins/rig-mcp-client/src/lib.rs:1056 — plugins/rig-mcp-client/src/lib.rs changed 12 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 15 (its worst body is rig_mcp_client::register at line 1056), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-rmcp): a server that declares no tools is not asked for them (#3296)”; “fix(rig-rmcp): client_config offers the released MCP protocol; examples and docs use it (#3289)”; “fix(rig-mcp-client): attribute MCP tools to the plugin that added McpCorePlugin (#3272)”; “fix(mcp-client): a server that wants an OAuth sign-in says so in plain words (#3229)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-mcp-client/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: plugins/rig-basics/src/helpers.rs plugins/rig-basics/src/helpers.rs:494 — plugins/rig-basics/src/helpers.rs changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is Runner::run at line 494), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(basics): settle a helper's count with try_update, which Rust 1.99 does not deprecate (#3215)”; “fix(basics): a helper timeout too long for a deadline is refused (#3141)”; “fix!: every limit on asked work is a settings.toml key with a sensible default, and rig says what it changes (#2995)”; “fix(tools)!: --tools limits only the run it is given to (#2984)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/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.
  • Repeated repair: crates/rig-memory/src/session.rs crates/rig-memory/src/session.rs:564 — crates/rig-memory/src/session.rs changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is Session::save at line 564), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(memory)!: undo restores only what a compaction replaced in this conversation, and read_conversation returns failed blob reads (#3095)”; “fix(memory): compaction cuts, concurrent DirFiles writes, masked blob errors and Session::save retries (#3046)”; “fix(tools,memory)!: a confined write never leaves its base, and a stale session save is refused (#2999)”; “fix(agent)!: Esc keeps the partial reply, /compact keeps history, accurate summaries, ctx ? after compaction (#2918)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-memory/src/session.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/rig-tools/src/lib.rs crates/rig-tools/src/lib.rs:243 — crates/rig-tools/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 5 (its worst body is Excerpt::mark at line 243), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tui): wrap the input at spaces, end a cut key-hint row in …, hang read and /help rows under their text (#3231)”; “fix(tools)!: tool results show what they found (#2965)”; “fix(rig-tools)!: a tool path starting with ~ is in the home directory (#2940)”; “fix(tools)!: read returns images, long lines can be read on, a clearer timeout hint (#2913)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/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: plugins/rig-basics/src/models.rs plugins/rig-basics/src/models.rs:174 — plugins/rig-basics/src/models.rs changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is rig_basics::models::choose_invoked_model at line 174), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-core, rig-ecs, rig-basics)!: one reader and printer for a reasoning setting as text, so [model] effort = "high" works on budget-only models (#3291)”; “fix(basics): a first pick names a saved key file it cannot read (#3168)”; “fix(models)!: /model lists only models you can use now; a model that doesn't connect is refused and the current one stays (#2983)”; “fix(models)!: only an explicit choice becomes the default; /model offers only models that answer (#2973)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/models.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: corpus/base/src/handoff.rs corpus/base/src/handoff.rs:125 — corpus/base/src/handoff.rs changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is corpus_base::handoff::handoff at line 125), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(compaction)!: rewrite the summary, and never clear an output without notes or a same-bytes re-read (#2975)”; “fix(harness)!: one current agent per session; a fork says what it copies (#2967)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- corpus/base/src/handoff.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/rig-tools/src/edit.rs crates/rig-tools/src/edit.rs:459 — crates/rig-tools/src/edit.rs changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is rig_tools::edit::apply_to at line 459), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tools)!: tool results show what they found (#2965)”; “fix(rig-tools)!: triobench round 8: a read of part of a small remote file gets it whole so an edit after it is one call, an edit's reply shows the changed lines and a few around them (#2860)”; “fix(rig-tools): triobench round 6: shell output drops terminal escape codes, a cut keeps the first and last errors, a remote write cut off mid-way says whether it happened, an edit after a write is one call (#2858)”; “fix(rig-tools): triobench round 4: edits apply in order, an edit of a file seen whole is one transport call, a stopped command says how it was stopped (#2857)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/edit.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/rig-tools/src/fs.rs crates/rig-tools/src/fs.rs:82 — crates/rig-tools/src/fs.rs changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is rig_tools::fs::write_atomic at line 82), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(harness): an existing private file's staged copy is never readable by others (#3166)”; “fix(tools,memory)!: a confined write never leaves its base, and a stale session save is refused (#2999)”; “fix(tools)!: tool results show what they found (#2965)”; “fix(rig-tools)!: a tool path starting with ~ is in the home directory (#2940)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/fs.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/rig-cli/src/update.rs crates/rig-cli/src/update.rs:106 — crates/rig-cli/src/update.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 5 (its worst body is rig_cli::update::install_and_build at line 106), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-cli): install rig from crates.io with --locked (#3267)”; “fix(rig-cli): keep exported secrets out of rig update's cargo install and rebuild (#3265)”; “fix(rig-cli): run rig update's cargo install away from the directory rig started in (#3260)”; “fix(rig-harness-protocol): say the command line that runs a launcher word given after options (#3259)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-cli/src/update.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: plugins/rig-basics/src/subagents/lifecycle.rs plugins/rig-basics/src/subagents/lifecycle.rs:462 — plugins/rig-basics/src/subagents/lifecycle.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 9 (its worst body is rig_basics::subagents::lifecycle::report_after_restore at line 462), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(harness)!: one run contract for every front; unknown input is refused out loud (#2972)”; “fix(agent)!: quitting mid-turn is a stop, and a restart carries nothing on by itself (#2943)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/subagents/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.
  • Repeated repair: crates/rig-tools/src/attach.rs crates/rig-tools/src/attach.rs:235 — crates/rig-tools/src/attach.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 12 (its worst body is rig_tools::attach::attachments at line 235), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tools)!: an @ reference attaches exactly the file that was picked (#2962)”; “fix(rig-tools)!: a tool path starting with ~ is in the home directory (#2940)”; “fix(tools)!: read returns images, long lines can be read on, a clearer timeout hint (#2913)”; “fix(tui)!: prompt history per project, the shown conversation's prompts first (#2916)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-tools/src/attach.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/rig-ecs/src/model.rs crates/rig-ecs/src/model.rs:197 — crates/rig-ecs/src/model.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is rig_ecs::model::on_set_model at line 197), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-core, rig-ecs, rig-basics)!: one reader and printer for a reasoning setting as text, so [model] effort = "high" works on budget-only models (#3291)”; “fix(rig-ecs, rig-basics): a reasoning effort the model can't take is reset out loud, budgets included (#3277)”; “fix(models)!: /model lists only models you can use now; a model that doesn't connect is refused and the current one stays (#2983)”; “fix(models)!: only an explicit choice becomes the default; /model offers only models that answer (#2973)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/model.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/rig-ecs/src/session_log.rs crates/rig-ecs/src/session_log.rs:147 — crates/rig-ecs/src/session_log.rs changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is rig_ecs::session_log::log_changed at line 147), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(print): rig --json writes ready before answering a request already waiting (#3216)”; “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(harness)!: one current agent per session; a fork says what it copies (#2967)”; “fix(tui, harness): one Ctrl+D quits; a session with no messages isn't saved (#2909)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- crates/rig-ecs/src/session_log.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: plugins/rig-tui/src/editor.rs plugins/rig-tui/src/editor.rs:746 — plugins/rig-tui/src/editor.rs changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is rig_tui::editor::draw_editors at line 746), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tui): wrap the input at spaces, end a cut key-hint row in …, hang read and /help rows under their text (#3231)”; “fix(tui,tools): the status line stays while typing, a failed pipe read is told, and a checkpoint warns of files it cannot read (#2998)”; “fix(tui)!: Up never loses what you typed, and a recalled command opens no list (#2947)”; “fix(tui)!: prompt history per project, the shown conversation's prompts first (#2916)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-tui/src/editor.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: plugins/rig-acp/src/session/questions.rs plugins/rig-acp/src/session/questions.rs:62 — plugins/rig-acp/src/session/questions.rs changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is Asking::ask at line 62), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-harness,rig-basics,rig-acp): one answer rule for every front, and the JSON front refuses a lost answer (#3140)”; “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(ecs)!: a call is known by its reply and place; every stop goes through one owner (#2985)”; “fix(io)!: input and output are bounded; a stop is never blocked by output (#2974)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-acp/src/session/questions.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: corpus/sp/src/subagent_result_cache.rs corpus/sp/src/subagent_result_cache.rs:334 — corpus/sp/src/subagent_result_cache.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is corpus_sp::subagent_result_cache::watch_effect at line 334), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rig-core, rig-ecs, rig-basics)!: one reader and printer for a reasoning setting as text, so [model] effort = "high" works on budget-only models (#3291)”; “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(tools)!: --tools limits only the run it is given to (#2984)”; “fix(tools)!: tool results show what they found (#2965)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- corpus/sp/src/subagent_result_cache.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: plugins/rig-basics/src/subagents/tools.rs plugins/rig-basics/src/subagents/tools.rs:308 — plugins/rig-basics/src/subagents/tools.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is Agents::reachable at line 308), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ecs)!: one spawn path for agents, with no depth limit, and requests owned by what made them (#2991)”; “fix(harness)!: one run contract for every front; unknown input is refused out loud (#2972)”; “fix(rig)!: triobench round 1: subagent messages and reports, remote HOST:PATH paths, shell streams and cuts, search paths, OSC 133 turn marks (#2849)”; “fix!: everything the pre-0.45 API review found (#2848)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 23:19:28 +00:00' --until='2026-11-13 23:19:28 +00:00' --full-history --no-merges -- plugins/rig-basics/src/subagents/tools.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.
  • + 28 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×32
  • FunctionTooLong: xtask::verify::checks::all xtask/src/verify/checks.rs:104 — FunctionTooLong — xtask::verify::checks::all runs 454 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 354 over it, 4.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: rig_claude_cloak::transport::body plugins/rig-claude-cloak/src/transport.rs:625 — FunctionTooLong — rig_claude_cloak::transport::body runs 205 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 105 over it, 2.05× 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: rig_cli::run::run_agent crates/rig-cli/src/run.rs:281 — FunctionTooLong — rig_cli::run::run_agent runs 201 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 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_derive::tool::expand::expand_rig_tool crates/rig-derive/src/tool/expand.rs:108 — FunctionTooLong — rig_derive::tool::expand::expand_rig_tool runs 158 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 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_basics::compaction::compact_near_the_window plugins/rig-basics/src/compaction.rs:1234 — FunctionTooLong — rig_basics::compaction::compact_near_the_window runs 154 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 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_core::providers::openai::responses_api::input crates/rig-core/src/providers/openai/responses_api/mod.rs:142 — FunctionTooLong — rig_core::providers::openai::responses_api::input runs 148 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 48 over it, 1.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: xtask::verify::execute::internal xtask/src/verify/execute.rs:40 — FunctionTooLong — xtask::verify::execute::internal runs 147 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 47 over it, 1.47× 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: rig_agent::run::prepare::prepare_request crates/rig-agent/src/run/prepare.rs:126 — FunctionTooLong — rig_agent::run::prepare::prepare_request runs 145 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 45 over it, 1.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: corpus_fh::editor_front::receive corpus/fh/src/editor_front.rs:542 — FunctionTooLong — corpus_fh::editor_front::receive runs 134 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 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_claude_cloak::transport::prompt_caching plugins/rig-claude-cloak/src/transport.rs:451 — FunctionTooLong — rig_claude_cloak::transport::prompt_caching runs 133 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 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_lancedb::utils::deserializer::valid_values crates/rig-lancedb/src/utils/deserializer.rs:57 — FunctionTooLong — rig_lancedb::utils::deserializer::valid_values runs 131 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 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_tui::render::lay_out_transcript plugins/rig-tui/src/render.rs:653 — FunctionTooLong — rig_tui::render::lay_out_transcript runs 131 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 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_tui::transcript::message_lines plugins/rig-tui/src/transcript.rs:1519 — FunctionTooLong — rig_tui::transcript::message_lines runs 127 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 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_cassette::http::replay_request crates/rig-cassette/src/http/mod.rs:1559 — FunctionTooLong — rig_cassette::http::replay_request runs 125 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 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_ecs::stage::build crates/rig-ecs/src/stage.rs:673 — FunctionTooLong — rig_ecs::stage::build runs 124 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 24 over it, 1.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: rig_ecs::stage::start crates/rig-ecs/src/stage.rs:1186 — FunctionTooLong — rig_ecs::stage::start runs 121 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 21 over it, 1.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.
  • FunctionTooLong: rig_basics::telemetry::usage::usage plugins/rig-basics/src/telemetry/usage.rs:439 — FunctionTooLong — rig_basics::telemetry::usage::usage runs 121 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 21 over it, 1.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.
  • FunctionTooLong: rig_candle::protocol::render_qwen_message crates/rig-candle/src/protocol.rs:518 — FunctionTooLong — rig_candle::protocol::render_qwen_message runs 116 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 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rig_cassette::scrub::capture_format crates/rig-cassette/src/scrub.rs:526 — FunctionTooLong — rig_cassette::scrub::capture_format runs 116 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 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: corpus_fh::import_sessions::parse::codex corpus/fh/src/import_sessions/parse.rs:443 — FunctionTooLong — corpus_fh::import_sessions::parse::codex runs 115 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 15 over it, 1.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: corpus_fh::prompt_cache_shaping::shape corpus/fh/src/prompt_cache_shaping.rs:143 — FunctionTooLong — corpus_fh::prompt_cache_shaping::shape runs 115 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 15 over it, 1.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: rig_agent::agent::engine::drive_tool_calls crates/rig-agent/src/agent/engine.rs:512 — FunctionTooLong — rig_agent::agent::engine::drive_tool_calls runs 114 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 14 over it, 1.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.
  • FunctionTooLong: rig_acp::session::install plugins/rig-acp/src/session.rs:230 — FunctionTooLong — rig_acp::session::install runs 114 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 14 over it, 1.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.
  • FunctionTooLong: rig_tui::render::draw_choice plugins/rig-tui/src/render.rs:1321 — FunctionTooLong — rig_tui::render::draw_choice runs 112 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 12 over it, 1.12× 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: rig_claude_cloak::schema::upgrade plugins/rig-claude-cloak/src/schema.rs:634 — FunctionTooLong — rig_claude_cloak::schema::upgrade runs 109 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 9 over it, 1.09× 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.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×28
  • Duplicated block (6 lines × 2) corpus/base/src/pinned_notes.rs:86 — corpus/base/src/pinned_notes.rs:86-91 | plugins/rig-basics/src/subagents/tools.rs:119-124 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/pinned_notes.rs:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/base/src/todo_tracker.rs:198 — corpus/base/src/todo_tracker.rs:198-203 | corpus/rf-03/src/todo.rs:201-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/todo_tracker.rs:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/ho/src/spend_by_origin.rs:240 — corpus/ho/src/spend_by_origin.rs:240-245 | corpus/sn/src/usage_report_cli/report.rs:198-203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/sn/src/terminal_sessions/pty.rs:137 — corpus/sn/src/terminal_sessions/pty.rs:137-142 | crates/rig-tools/src/process.rs:323-328 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/sn/src/terminal_sessions/pty.rs:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/rig-cassette/src/scrub.rs:1817 — crates/rig-cassette/src/scrub.rs:1817-1822 | crates/rig-cassette/src/scrub.rs:1893-1901 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-cassette/src/scrub.rs:1817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/rig-core/src/providers/openai/options.rs:1015 — crates/rig-core/src/providers/openai/options.rs:1015-1020 | crates/rig-core/src/providers/openai/options.rs:1476-1481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:1015` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) crates/rig-reqwest/src/lib.rs:470 — crates/rig-reqwest/src/lib.rs:470-475 | crates/rig-reqwest/src/middleware.rs:56-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-reqwest/src/lib.rs:470` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/base/src/handoff.rs:209 — corpus/base/src/handoff.rs:209-214 | corpus/oc/src/away_recap.rs:334-339 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `corpus/base/src/handoff.rs:207` calls `trigger`, `plugin_alone` and `corpus/oc/src/away_recap.rs:332` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) corpus/base/src/skills.rs:183 — corpus/base/src/skills.rs:183-188 | corpus/sn/src/glob_rules.rs:196-201 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) corpus/ct/src/history_versions.rs:344 — corpus/ct/src/history_versions.rs:344-349 | plugins/rig-basics/src/skills.rs:360-365 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/history_versions.rs:344` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/fh/src/encrypted_sessions/reseal.rs:187 — corpus/fh/src/encrypted_sessions/reseal.rs:187-192 | corpus/oc/src/session_bundle.rs:291-296 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/oc/src/architect_editor.rs:260 — corpus/oc/src/architect_editor.rs:260-265 | corpus/shared/src/plan_mode.rs:127-132 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/oc/src/architect_editor.rs:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/rig-cassette/src/scrub.rs:2065 — crates/rig-cassette/src/scrub.rs:2065-2070 | crates/rig-cassette/src/scrub.rs:2520-2525 — both copies are in the same file, so extract the block into 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/rig-core/src/effect/mod.rs:110 — crates/rig-core/src/effect/mod.rs:110-115 | crates/rig-core/src/effect/mod.rs:129-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 (6 lines × 2) plugins/rig-tui/src/render.rs:795 — plugins/rig-tui/src/render.rs:795-800 | plugins/rig-tui/src/transcript.rs:1666-1671 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `plugins/rig-tui/src/render.rs:795` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/base/src/export/render.rs:510 — corpus/base/src/export/render.rs:510-515 | plugins/rig-basics/src/skills.rs:351-356 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/ct/src/shell_companion/socket.rs:37 — corpus/ct/src/shell_companion/socket.rs:37-42 | corpus/ho/src/socket_attach/server.rs:47-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `corpus/ho/src/socket_attach/server.rs:43` calls `pub` and `corpus/ct/src/shell_companion/socket.rs:33` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) corpus/fh/src/thinking_keywords.rs:157 — corpus/fh/src/thinking_keywords.rs:157-162 | corpus/shared/src/few_shot_examples.rs:210-215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-bedrock/src/completion.rs:218 — crates/rig-bedrock/src/completion.rs:218-223 | crates/rig-vertexai/src/completion.rs:69-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-bedrock/src/extension.rs:260 — crates/rig-bedrock/src/extension.rs:260-265 | crates/rig-core/src/providers/cohere/extension.rs:240-245 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/rig-core/src/providers/minimax/voice_clone.rs:326 — crates/rig-core/src/providers/minimax/voice_clone.rs:326-331 | crates/rig-core/src/providers/openai/wire/modality.rs:1148-1154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-core/src/completion/message.rs:109 — crates/rig-core/src/completion/message.rs:109-114 | crates/rig-core/src/completion/request.rs:604-609 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) corpus/base/src/skills.rs:369 — corpus/base/src/skills.rs:369-374 | corpus/ho/src/blackboard.rs:360-365 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/skills.rs:369` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/rig-memory/src/rewrite.rs:564 — crates/rig-memory/src/rewrite.rs:564-569 | crates/rig-memory/src/rewrite.rs:573-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-memory/src/rewrite.rs:564` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) corpus/base/src/auto_commit.rs:528 — corpus/base/src/auto_commit.rs:528-533 | corpus/fh/src/dirty_tree_guard.rs:153-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. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/auto_commit.rs:528` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · rig_core · ×25
  • rig_core::providers::openai::responses_api::input (cognitive 92) crates/rig-core/src/providers/openai/responses_api/mod.rs:142 — rig_core::providers::openai::responses_api::input has cognitive complexity 92 (threshold 15). Drivers by points: if/else 15 (56 pts), match/switch 6 (23 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::internal::schema::sanitize_schema (cognitive 56) crates/rig-core/src/providers/internal/schema.rs:24 — rig_core::providers::internal::schema::sanitize_schema has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 5 (16 pts), boolean chains 8, match/switch 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::conversation::pairing::walk (cognitive 54) crates/rig-core/src/conversation/pairing.rs:461 — rig_core::conversation::pairing::walk has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (36 pts), match/switch 3 (9 pts), boolean chains 5, loops 2 (4 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.
  • rig_core::completion::history::user (cognitive 47) crates/rig-core/src/completion/history.rs:1553 — rig_core::completion::history::user has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 8, match/switch 2 (5 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::completion::history::assistant (cognitive 46) crates/rig-core/src/completion/history.rs:1211 — rig_core::completion::history::assistant has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 8, match/switch 4 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::deepseek::strict_node (cognitive 46) crates/rig-core/src/providers/deepseek.rs:213 — rig_core::providers::deepseek::strict_node has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 5 (10 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.
  • rig_core::providers::anthropic::completion::strict_schema (cognitive 40) crates/rig-core/src/providers/anthropic/completion.rs:1356 — rig_core::providers::anthropic::completion::strict_schema has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (24 pts), match/switch 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::anthropic::completion::apply_cache_control (cognitive 32) crates/rig-core/src/providers/anthropic/completion.rs:1023 — rig_core::providers::anthropic::completion::apply_cache_control has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::gemini::interactions_api::steps (cognitive 28) crates/rig-core/src/providers/gemini/interactions_api/mod.rs:578 — rig_core::providers::gemini::interactions_api::steps has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (7 pts), match/switch 2 (6 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.
  • rig_core::providers::anthropic::completion::base (cognitive 24) crates/rig-core/src/providers/anthropic/completion.rs:234 — rig_core::providers::anthropic::completion::base has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::completion::history::hosted_pairs (cognitive 23) crates/rig-core/src/completion/history.rs:1400 — rig_core::completion::history::hosted_pairs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), match/switch 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.
  • rig_core::providers::openai::options::chat_options (cognitive 22) crates/rig-core/src/providers/openai/options.rs:481 — rig_core::providers::openai::options::chat_options has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rig_core::json_utils::parse_partial_object (cognitive 20) crates/rig-core/src/json_utils.rs:235 — rig_core::json_utils::parse_partial_object has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (6 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::completion::options::merge::apply (cognitive 19) crates/rig-core/src/completion/options/merge.rs:875 — rig_core::completion::options::merge::apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (2 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.
  • rig_core::providers::openai::wire::chat::document::merge_call (cognitive 19) crates/rig-core/src/providers/openai/wire/chat/document.rs:232 — rig_core::providers::openai::wire::chat::document::merge_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 3 (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.
  • rig_core::providers::anthropic::completion::merge_all_of (cognitive 18) crates/rig-core/src/providers/anthropic/completion.rs:1279 — rig_core::providers::anthropic::completion::merge_all_of has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 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.
  • rig_core::completion::history::adapt_for (cognitive 17) crates/rig-core/src/completion/history.rs:618 — rig_core::completion::history::adapt_for has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, match/switch 2 (4 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.
  • rig_core::completion::history::settled (cognitive 17) crates/rig-core/src/completion/history.rs:772 — rig_core::completion::history::settled has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::openai::wire::chat::rewrite_body (cognitive 17) crates/rig-core/src/providers/openai/wire/chat.rs:498 — rig_core::providers::openai::wire::chat::rewrite_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_core::completion::history::paired (cognitive 16) crates/rig-core/src/completion/history.rs:1453 — rig_core::completion::history::paired has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), loops 2, match/switch 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.
  • rig_core::completion::options::merge::placed (cognitive 16) crates/rig-core/src/completion/options/merge.rs:682 — rig_core::completion::options::merge::placed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 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.
  • rig_core::completion::options::merge::request_params (cognitive 16) crates/rig-core/src/completion/options/merge.rs:791 — rig_core::completion::options::merge::request_params has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 5 (6 pts), match/switch 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::anthropic::completion::message_json (cognitive 16) crates/rig-core/src/providers/anthropic/completion.rs:368 — rig_core::providers::anthropic::completion::message_json has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_core::providers::anthropic::completion::repoint_moved_references (cognitive 16) crates/rig-core/src/providers/anthropic/completion.rs:733 — rig_core::providers::anthropic::completion::repoint_moved_references has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 3, loops 3, match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_core::providers::gemini::streaming::document::part_into (cognitive 16) crates/rig-core/src/providers/gemini/streaming/document.rs:163 — rig_core::providers::gemini::streaming::document::part_into has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · xtask · ×25
  • xtask::driver_adoption::mask_literals_and_comments (cognitive 86) xtask/src/driver_adoption.rs:65 — xtask::driver_adoption::mask_literals_and_comments has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (56 pts), loops 5 (19 pts), boolean chains 6, match/switch 2 (5 pts) (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.
  • xtask::driver_adoption::macro_body (cognitive 58) xtask/src/driver_adoption.rs:558 — xtask::driver_adoption::macro_body has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 7 (18 pts), match/switch 2 (6 pts), boolean chains 4 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::verify::execute::internal (cognitive 50) xtask/src/verify/execute.rs:40 — xtask::verify::execute::internal has cognitive complexity 50 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 5 (12 pts), boolean chains 11, match/switch 2 (3 pts) (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • xtask::cassette::scan::scan (cognitive 43) xtask/src/cassette/scan.rs:112 — xtask::cassette::scan::scan has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 10 (13 pts), boolean chains 6 (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.
  • xtask::catalog::pin (cognitive 38) xtask/src/catalog.rs:481 — xtask::catalog::pin has cognitive complexity 38 (threshold 15). Drivers by points: loops 10 (18 pts), if/else 4 (12 pts), match/switch 3 (7 pts), boolean chains 1 (nesting depth added 20). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • xtask::verify::preflight::run (cognitive 37) xtask/src/verify/preflight.rs:10 — xtask::verify::preflight::run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::verify::plan::plan (cognitive 36) xtask/src/verify/plan.rs:180 — xtask::verify::plan::plan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::cassette::owner::module_map (cognitive 32) xtask/src/cassette/owner.rs:72 — xtask::cassette::owner::module_map has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (3 pts), 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.
  • xtask::catalog::serve (cognitive 32) xtask/src/catalog.rs:702 — xtask::catalog::serve has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 3 (6 pts), match/switch 1 (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.
  • xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs (cognitive 31) xtask/src/driver_adoption.rs:730 — xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 4 (8 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.
  • xtask::catalog::guard::reviewed_facts (cognitive 27) xtask/src/catalog/guard.rs:616 — xtask::catalog::guard::reviewed_facts has cognitive complexity 27 (threshold 15). Drivers by points: loops 4 (10 pts), match/switch 2 (9 pts), if/else 2 (7 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::catalog::translate_reasoning (cognitive 26) xtask/src/catalog.rs:750 — xtask::catalog::translate_reasoning has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (10 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::bevy::check (cognitive 22) xtask/src/bevy.rs:19 — xtask::bevy::check has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::catalog::validate_review (cognitive 22) xtask/src/catalog.rs:592 — xtask::catalog::validate_review has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (9 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.
  • xtask::cassette::scan::key_shape (cognitive 20) xtask/src/cassette/scan.rs:38 — xtask::cassette::scan::key_shape has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, 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.
  • xtask::cassette::shapes::walk_facts (cognitive 20) xtask/src/cassette/shapes.rs:232 — xtask::cassette::shapes::walk_facts has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), match/switch 3 (7 pts), if/else 1 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • xtask::catalog::guard::changes (cognitive 20) xtask/src/catalog/guard.rs:174 — xtask::catalog::guard::changes has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 6 (8 pts), loops 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • xtask::cassette::spend::spend (cognitive 19) xtask/src/cassette/spend.rs:186 — xtask::cassette::spend::spend has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::cassette::record::run (cognitive 18) xtask/src/cassette/record.rs:193 — xtask::cassette::record::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xtask::catalog::guard::provenance (cognitive 18) xtask/src/catalog/guard.rs:796 — xtask::catalog::guard::provenance has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (10 pts), loops 4 (5 pts), if/else 1 (2 pts), boolean chains 1 (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.
  • xtask::verify::execute::run (cognitive 18) xtask/src/verify/execute.rs:244 — xtask::verify::execute::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 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.
  • xtask::cassette::bank::walk (cognitive 16) xtask/src/cassette/bank.rs:427 — xtask::cassette::bank::walk has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 4, if/else 2 (4 pts), loops 2 (4 pts), match/switch 2 (4 pts) (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.
  • xtask::catalog::guard::compare (cognitive 16) xtask/src/catalog/guard.rs:415 — xtask::catalog::guard::compare has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 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.
  • xtask::catalog::guard::count (cognitive 16) xtask/src/catalog/guard.rs:578 — xtask::catalog::guard::count has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (9 pts), loops 3 (4 pts), if/else 1 (3 pts) (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.
  • xtask::verify::run (cognitive 16) xtask/src/verify.rs:131 — xtask::verify::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (7 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×19
  • Duplicated block (8 lines × 2) corpus/base/src/auto_commit.rs:235 — corpus/base/src/auto_commit.rs:235-242 | corpus/base/src/auto_commit.rs:335-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/auto_commit.rs:235` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) corpus/base/src/handoff.rs:154 — corpus/base/src/handoff.rs:154-161 | corpus/ct/src/conversation_chapters.rs:757-764 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/handoff.rs:154` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) corpus/base/src/http_api/server.rs:93 — corpus/base/src/http_api/server.rs:93-100 | corpus/ct/src/metrics_endpoint/server.rs:36-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) corpus/fh/src/lsp_tools.rs:714 — corpus/fh/src/lsp_tools.rs:714-721 | corpus/fh/src/lsp_tools.rs:761-768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) corpus/sn/src/sessions_prune_cli.rs:121 — corpus/sn/src/sessions_prune_cli.rs:121-128 | corpus/sn/src/usage_report_cli/options.rs:146-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. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/sn/src/sessions_prune_cli.rs:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/rig-bedrock/src/options.rs:79 — crates/rig-bedrock/src/options.rs:79-86 | crates/rig-core/src/providers/anthropic/options.rs:78-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-bedrock/src/options.rs:79` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) crates/rig-core/src/providers/cohere/chat.rs:164 — crates/rig-core/src/providers/cohere/chat.rs:164-171 | crates/rig-core/src/providers/ollama/chat.rs:175-182 — `crates/rig-core/src/providers/cohere/chat.rs` and `crates/rig-core/src/providers/ollama/chat.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/cohere/chat.rs:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/rig-core/src/providers/ollama/chat.rs:323 — crates/rig-core/src/providers/ollama/chat.rs:323-330 | crates/rig-core/src/providers/openai/wire/chat.rs:568-575 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/library/src/session_doctor_library.rs:364 — corpus/library/src/session_doctor_library.rs:364-371 | corpus/library/src/session_edit_library.rs:662-669 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) corpus/sn/src/task_queue.rs:344 — corpus/sn/src/task_queue.rs:344-351 | plugins/rig-basics/src/sessions/agents.rs:122-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) crates/rig-candle/src/model.rs:650 — crates/rig-candle/src/model.rs:650-657 | crates/rig-candle/src/model.rs:687-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-candle/src/model.rs:650` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) plugins/rig-claude-cloak/src/transport.rs:484 — plugins/rig-claude-cloak/src/transport.rs:484-491 | plugins/rig-claude-cloak/src/transport.rs:608-615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/rig-claude-cloak/src/transport.rs:484` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/rig-core/src/providers/cohere/embeddings.rs:68 — crates/rig-core/src/providers/cohere/embeddings.rs:68-75 | crates/rig-core/src/providers/voyageai/wire.rs:98-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-postgres/src/lib.rs:254 — crates/rig-postgres/src/lib.rs:254-261 | crates/rig-surrealdb/src/lib.rs:264-271 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-postgres/src/lib.rs:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rig-surrealdb/src/lib.rs:273` calls `inner_client` and `crates/rig-postgres/src/lib.rs:263` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) corpus/ho/src/api_key_pool.rs:393 — corpus/ho/src/api_key_pool.rs:393-400 | corpus/oc/src/rate_limit_status.rs:215-222 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-core/src/providers/openai/wire/modality.rs:640 — crates/rig-core/src/providers/openai/wire/modality.rs:640-647 | crates/rig-core/src/providers/openai/wire/modality.rs:1540-1548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/wire/modality.rs:1540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `Vec<String>` in one and `crate::operation::RerankRequest` 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 × 2) crates/rig-cassette/src/http/snapshot.rs:488 — crates/rig-cassette/src/http/snapshot.rs:488-495 | xtask/src/cassette/acceptance.rs:324-331 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-cassette/src/http/snapshot.rs:488` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) crates/rig-core/src/providers/openai/options.rs:573 — crates/rig-core/src/providers/openai/options.rs:573-580 | crates/rig-core/src/providers/openai/options.rs:1331-1338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) corpus/ho/src/throughput_item.rs:292 — corpus/ho/src/throughput_item.rs:292-299 | corpus/ho/src/tool_arg_repair.rs:184-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `corpus/ho/src/throughput_item.rs:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D2 · Cognitive Complexity · corpus_sn · ×18
  • corpus_sn::crash_resume::recover (cognitive 35) corpus/sn/src/crash_resume.rs:207 — corpus_sn::crash_resume::recover has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 6 (8 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.
  • corpus_sn::untrusted_quarantine::fence (cognitive 31) corpus/sn/src/untrusted_quarantine.rs:281 — corpus_sn::untrusted_quarantine::fence has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::crash_resume::resolve (cognitive 26) corpus/sn/src/crash_resume.rs:417 — corpus_sn::crash_resume::resolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::race_models::claim (cognitive 26) corpus/sn/src/race_models.rs:410 — corpus_sn::race_models::claim has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (22 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.
  • corpus_sn::sessions_prune_cli::plan (cognitive 26) corpus/sn/src/sessions_prune_cli.rs:341 — corpus_sn::sessions_prune_cli::plan has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::vim_input::edit (cognitive 26) corpus/sn/src/vim_input.rs:145 — corpus_sn::vim_input::edit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (7 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::untrusted_quarantine::scan (cognitive 23) corpus/sn/src/untrusted_quarantine.rs:350 — corpus_sn::untrusted_quarantine::scan has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 2 (3 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.
  • corpus_sn::glob_rules::deliver (cognitive 22) corpus/sn/src/glob_rules.rs:377 — corpus_sn::glob_rules::deliver has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 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.
  • corpus_sn::tool_stats::work (cognitive 21) corpus/sn/src/tool_stats.rs:165 — corpus_sn::tool_stats::work has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 3 (9 pts), loops 3 (7 pts), if/else 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.
  • corpus_sn::vim_input::editor::parse (cognitive 21) corpus/sn/src/vim_input/editor.rs:409 — corpus_sn::vim_input::editor::parse has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (14 pts), if/else 6 (7 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.
  • corpus_sn::model_params::put (cognitive 20) corpus/sn/src/model_params.rs:476 — corpus_sn::model_params::put has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (7 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.
  • corpus_sn::race_models::drop_out (cognitive 20) corpus/sn/src/race_models.rs:555 — corpus_sn::race_models::drop_out has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::file_annotations::annotate_reads (cognitive 19) corpus/sn/src/file_annotations.rs:203 — corpus_sn::file_annotations::annotate_reads has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::web_fetch::answered (cognitive 19) corpus/sn/src/web_fetch.rs:177 — corpus_sn::web_fetch::answered has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 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.
  • corpus_sn::plugin_profiler::frame_ended (cognitive 18) corpus/sn/src/plugin_profiler.rs:531 — corpus_sn::plugin_profiler::frame_ended has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::leftover_detector::snapshot (cognitive 17) corpus/sn/src/leftover_detector.rs:299 — corpus_sn::leftover_detector::snapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sn::model_params::check (cognitive 17) corpus/sn/src/model_params.rs:342 — corpus_sn::model_params::check has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • corpus_sn::race_models::list_errors (cognitive 17) corpus/sn/src/race_models.rs:484 — corpus_sn::race_models::list_errors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corpus_oc · ×17
  • corpus_oc::transcript_in_editor::rebuild (cognitive 48) corpus/oc/src/transcript_in_editor.rs:492 — corpus_oc::transcript_in_editor::rebuild has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (25 pts), match/switch 5 (12 pts), loops 4 (11 pts) (nesting depth added 31). 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.
  • corpus_oc::transcript_in_editor::render (cognitive 37) corpus/oc/src/transcript_in_editor.rs:229 — corpus_oc::transcript_in_editor::render has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 4 (16 pts), loops 5 (13 pts), if/else 2 (8 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.
  • corpus_oc::inline_images::sixel (cognitive 31) corpus/oc/src/inline_images.rs:674 — corpus_oc::inline_images::sixel has cognitive complexity 31 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 6 (12 pts), match/switch 1 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::transcript_in_editor::parse_body (cognitive 27) corpus/oc/src/transcript_in_editor.rs:351 — corpus_oc::transcript_in_editor::parse_body has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::git_delta_context::annotate (cognitive 24) corpus/oc/src/git_delta_context.rs:192 — corpus_oc::git_delta_context::annotate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 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.
  • corpus_oc::dependency_guard::gate (cognitive 23) corpus/oc/src/dependency_guard.rs:323 — corpus_oc::dependency_guard::gate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::steer_and_queue::strip_keys (cognitive 23) corpus/oc/src/steer_and_queue.rs:404 — corpus_oc::steer_and_queue::strip_keys has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::dataset_cli::dataset::chat_messages (cognitive 22) corpus/oc/src/dataset_cli/dataset.rs:395 — corpus_oc::dataset_cli::dataset::chat_messages has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 3 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • corpus_oc::dataset_cli::dataset::session_lines (cognitive 20) corpus/oc/src/dataset_cli/dataset.rs:175 — corpus_oc::dataset_cli::dataset::session_lines has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::architect_editor::report (cognitive 18) corpus/oc/src/architect_editor.rs:573 — corpus_oc::architect_editor::report has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (7 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.
  • corpus_oc::reviewable_compaction::uncompact (cognitive 18) corpus/oc/src/reviewable_compaction.rs:285 — corpus_oc::reviewable_compaction::uncompact has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • corpus_oc::transcript_in_editor::finish (cognitive 18) corpus/oc/src/transcript_in_editor.rs:687 — corpus_oc::transcript_in_editor::finish has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::auto_continue::join (cognitive 17) corpus/oc/src/auto_continue.rs:308 — corpus_oc::auto_continue::join has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::dependency_guard::answered (cognitive 17) corpus/oc/src/dependency_guard.rs:437 — corpus_oc::dependency_guard::answered has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (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.
  • corpus_oc::line_provenance::provenance (cognitive 17) corpus/oc/src/line_provenance.rs:456 — corpus_oc::line_provenance::provenance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_oc::transcript_in_editor::edit_history (cognitive 17) corpus/oc/src/transcript_in_editor.rs:883 — corpus_oc::transcript_in_editor::edit_history has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • corpus_oc::auto_continue::add_partial (cognitive 16) corpus/oc/src/auto_continue.rs:220 — corpus_oc::auto_continue::add_partial has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×17
  • Edited copy of a member (7 corresponding lines) plugins/rig-basics/src/session_picker.rs:155 — plugins/rig-basics/src/session_picker.rs:155-161 | plugins/rig-basics/src/welcome.rs:109-119 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/base/src/custom_provider.rs:43 — corpus/base/src/custom_provider.rs:43-49 | corpus/ho/src/command_provider.rs:81-87 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/base/src/review_agent.rs:284 — corpus/base/src/review_agent.rs:284-290 | plugins/rig-basics/src/preview.rs:140-146 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/ct/src/reply_review_comments.rs:99 — corpus/ct/src/reply_review_comments.rs:99-105 | crates/rig-ecs/src/restore.rs:122-129 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/rig-candle/src/pose/network.rs:85 — crates/rig-candle/src/pose/network.rs:85-91 | crates/rig-candle/src/pose/network.rs:147-154 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/ho/src/tool_arg_repair/repair.rs:53 — corpus/ho/src/tool_arg_repair/repair.rs:53-59 | corpus/sn/src/notebook_cells/notebook.rs:156-162 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/rig-core/src/conversation/mod.rs:1170 — crates/rig-core/src/conversation/mod.rs:1170-1176 | crates/rig-tools/src/overlay.rs:69-75 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/sp/src/dead_ends_ledger.rs:213 — corpus/sp/src/dead_ends_ledger.rs:213-219 | corpus/base/src/pinned_notes.rs:130-136 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/base/src/checkpoint_rewind.rs:294 — corpus/base/src/checkpoint_rewind.rs:294-300 | corpus/base/src/checkpoint_rewind.rs:309-315 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/sn/src/terminal_sessions.rs:517 — corpus/sn/src/terminal_sessions.rs:517-523 | plugins/rig-basics/src/subagents/lifecycle.rs:450-456 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/rig-memory/src/dir.rs:124 — crates/rig-memory/src/dir.rs:124-130 | crates/rig-memory/src/store.rs:313-320 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/base/src/code_search_index.rs:744 — corpus/base/src/code_search_index.rs:744-750 | corpus/base/src/retry_with_model.rs:192-198 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/rig-memory/src/compaction.rs:361 — crates/rig-memory/src/compaction.rs:361-367 | crates/rig-memory/src/tokens.rs:279-285 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/ho/src/dry_run.rs:339 — corpus/ho/src/dry_run.rs:339-345 | corpus/ho/src/spend_by_origin.rs:170-176 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) corpus/sp/src/churn_monitor.rs:220 — corpus/sp/src/churn_monitor.rs:220-226 | crates/rig-cassette/src/http/mod.rs:2148-2154 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) test-support/rig-test-support/src/comparison_guard.rs:382 — test-support/rig-test-support/src/comparison_guard.rs:382-388 | test-support/rig-test-support/src/comparison_guard.rs:390-396 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/rig-http/src/test_utils.rs:253 — crates/rig-http/src/test_utils.rs:253-259 | crates/rig-http/src/test_utils.rs:267-274 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×17
  • Duplicated block (7 lines × 2) corpus/base/src/share/render.rs:124 — corpus/base/src/share/render.rs:124-130 | crates/rig-core/src/providers/internal/auth/loopback.rs:493-499 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/share/render.rs:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rig-core/src/providers/internal/auth/loopback.rs:500` calls `push_str` and `corpus/base/src/share/render.rs:131` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) crates/rig-candle/src/generation.rs:586 — crates/rig-candle/src/generation.rs:586-592 | crates/rig-candle/src/generation.rs:643-649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/rig-candle/src/loader.rs:121 — crates/rig-candle/src/loader.rs:121-127 | crates/rig-candle/src/loader.rs:163-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-candle/src/loader.rs:121` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-core/src/providers/gemini/audio_generation.rs:352 — crates/rig-core/src/providers/gemini/audio_generation.rs:352-358 | crates/rig-core/src/providers/gemini/image_generation.rs:214-220 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/rig-core/src/tool/validate.rs:486 — crates/rig-core/src/tool/validate.rs:486-492 | test-support/rig-history-conformance/src/lib.rs:725-732 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/tool/validate.rs:486` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) plugins/rig-tui/src/input.rs:503 — plugins/rig-tui/src/input.rs:503-509 | plugins/rig-tui/src/input.rs:544-550 — both copies are in the same file, so extract the block into 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/rig-core/src/loaders/epub/loader.rs:252 — crates/rig-core/src/loaders/epub/loader.rs:252-258 | crates/rig-core/src/loaders/pdf.rs:259-265 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-cassette/src/scrub.rs:2288 — crates/rig-cassette/src/scrub.rs:2288-2294 | crates/rig-cassette/src/scrub.rs:2321-2327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-cassette/src/scrub.rs:2288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-agent/src/run/response.rs:326 — crates/rig-agent/src/run/response.rs:326-332 | crates/rig-core/src/completion/options.rs:400-406 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-core/src/catalog/row.rs:700 — crates/rig-core/src/catalog/row.rs:700-706 | plugins/rig-basics/src/compaction.rs:210-216 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-core/src/providers/gemini/completion.rs:169 — crates/rig-core/src/providers/gemini/completion.rs:169-175 | crates/rig-gemini-grpc/src/completion.rs:75-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) test-support/rig-test-support/src/comparison_guard.rs:61 — test-support/rig-test-support/src/comparison_guard.rs:61-67 | xtask/src/cassette/owner.rs:182-188 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/base/src/check_after_turn.rs:405 — corpus/base/src/check_after_turn.rs:405-411 | corpus/fh/src/batch_provider.rs:609-615 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/fh/src/batch_provider.rs:609` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-qdrant/src/filter.rs:292 — crates/rig-qdrant/src/filter.rs:292-298 | crates/rig-qdrant/src/filter.rs:303-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-qdrant/src/filter.rs:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-core/src/providers/openai/options.rs:1188 — crates/rig-core/src/providers/openai/options.rs:1188-1194 | crates/rig-core/src/providers/openai/options.rs:1234-1240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:1188` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-core/src/providers/anthropic/options.rs:203 — crates/rig-core/src/providers/anthropic/options.rs:203-209 | crates/rig-core/src/providers/anthropic/options.rs:282-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/anthropic/options.rs:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/rig-agent/src/test_utils/model_conformance.rs:98 — crates/rig-agent/src/test_utils/model_conformance.rs:98-104 | crates/rig-agent/src/test_utils/model_conformance.rs:767-773 — both copies are in the same file, so extract the 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 × 2) · ×17
  • Duplicated block (5 lines × 2) corpus/base/src/format_on_write.rs:291 — corpus/base/src/format_on_write.rs:291-295 | crates/rig-tools/src/edit.rs:830-834 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/library/src/session_compare_library.rs:289 — corpus/library/src/session_compare_library.rs:289-293 | crates/rig-memory/src/meta.rs:124-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/library/src/session_compare_library.rs:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/rig-core/src/providers/cohere/chat.rs:486 — crates/rig-core/src/providers/cohere/chat.rs:486-490 | crates/rig-core/src/providers/ollama/chat.rs:428-432 — `crates/rig-core/src/providers/cohere/chat.rs` and `crates/rig-core/src/providers/ollama/chat.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/cohere/chat.rs:486` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) corpus/base/src/code_search_index.rs:734 — corpus/base/src/code_search_index.rs:734-738 | corpus/fh/src/thinking_keywords.rs:240-244 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/code_search_index.rs:734` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `messages` to `Query<(&TurnContext, &DeliveredIn)>` in one and `Query<(&ThinkKeyword, &DeliveredIn)>` 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 (5 lines × 2) corpus/base/src/tool_search.rs:242 — corpus/base/src/tool_search.rs:242-246 | corpus/ho/src/session_recall.rs:569-573 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/ct/src/test_runner_tool.rs:502 — corpus/ct/src/test_runner_tool.rs:502-506 | corpus/ho/src/cancellable_run.rs:360-364 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) corpus/ho/src/raw_stream_log.rs:281 — corpus/ho/src/raw_stream_log.rs:281-285 | corpus/sn/src/model_params.rs:691-695 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `gone` to `On<Remove<RawFile>>` in one and `On<Remove<Headed>>` 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 (5 lines × 2) corpus/sp/src/theme_files.rs:286 — corpus/sp/src/theme_files.rs:286-290 | crates/rig-tools/src/edit.rs:680-684 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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/rig-core/src/audio_generation.rs:96 — crates/rig-core/src/audio_generation.rs:96-100 | crates/rig-core/src/image_generation.rs:117-121 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/rig-core/src/providers/gemini/extension.rs:110 — crates/rig-core/src/providers/gemini/extension.rs:110-114 | crates/rig-vertexai/src/extension.rs:114-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/gemini/extension.rs:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/rig-tools/src/list.rs:121 — crates/rig-tools/src/list.rs:121-125 | crates/rig-tools/src/search.rs:213-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. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `&ListArgs` in one and `&SearchArgs` 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 (5 lines × 2) corpus/base/src/review_agent.rs:628 — corpus/base/src/review_agent.rs:628-632 | plugins/rig-basics/src/reload/plugins.rs:218-222 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/review_agent.rs:628` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/rig-core/src/tool/validate.rs:173 — crates/rig-core/src/tool/validate.rs:173-177 | crates/rig-core/src/tool/validate.rs:182-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/tool/validate.rs:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) corpus/base/src/skills.rs:277 — corpus/base/src/skills.rs:277-281 | corpus/sn/src/glob_rules.rs:363-367 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/skills.rs:277` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) corpus/ct/src/session_finder.rs:553 — corpus/ct/src/session_finder.rs:553-557 | corpus/ct/src/session_finder.rs:645-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. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/session_finder.rs:645` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) corpus/fh/src/import_sessions/parse.rs:304 — corpus/fh/src/import_sessions/parse.rs:304-308 | corpus/fh/src/import_sessions/parse.rs:446-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/fh/src/import_sessions/parse.rs:304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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, `corpus/fh/src/import_sessions/parse.rs:451` calls `millis`, `get`, `cloned` and `corpus/fh/src/import_sessions/parse.rs:309` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) crates/rig-candle/src/model.rs:695 — crates/rig-candle/src/model.rs:695-699 | crates/rig-candle/src/pose.rs:690-694 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `crates/rig-candle/src/model.rs:695` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D2 · Cognitive Complexity · corpus_fh · ×16
  • corpus_fh::editor_front::receive (cognitive 72) corpus/fh/src/editor_front.rs:542 — corpus_fh::editor_front::receive has cognitive complexity 72 (threshold 15). Drivers by points: if/else 17 (50 pts), loops 5 (15 pts), match/switch 3 (7 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_fh::prompt_cache_shaping::shape (cognitive 49) corpus/fh/src/prompt_cache_shaping.rs:143 — corpus_fh::prompt_cache_shaping::shape has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 5 (15 pts), loops 2 (4 pts), boolean chains 2 (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.
  • corpus_fh::apply_patch_tool::patch::parse (cognitive 40) corpus/fh/src/apply_patch_tool/patch.rs:162 — corpus_fh::apply_patch_tool::patch::parse has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 2 (8 pts), loops 3 (7 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.
  • corpus_fh::checklist_runner::schedule (cognitive 38) corpus/fh/src/checklist_runner.rs:606 — corpus_fh::checklist_runner::schedule has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (8 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.
  • corpus_fh::import_sessions::parse::claude_code (cognitive 38) corpus/fh/src/import_sessions/parse.rs:299 — corpus_fh::import_sessions::parse::claude_code has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 3 (10 pts), loops 3 (7 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.
  • corpus_fh::apply_patch_tool::gate_together (cognitive 36) corpus/fh/src/apply_patch_tool.rs:321 — corpus_fh::apply_patch_tool::gate_together has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 6 (16 pts), boolean chains 4 (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.
  • corpus_fh::apply_patch_tool::patch::check (cognitive 36) corpus/fh/src/apply_patch_tool/patch.rs:50 — corpus_fh::apply_patch_tool::patch::check has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (10 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_fh::batch_provider::take_over (cognitive 22) corpus/fh/src/batch_provider.rs:292 — corpus_fh::batch_provider::take_over has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_fh::import_sessions::parse::codex (cognitive 20) corpus/fh/src/import_sessions/parse.rs:443 — corpus_fh::import_sessions::parse::codex has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 2 (6 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • corpus_fh::rich_tool_rendering::highlight::spans (cognitive 20) corpus/fh/src/rich_tool_rendering/highlight.rs:115 — corpus_fh::rich_tool_rendering::highlight::spans has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, match/switch 2 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • corpus_fh::step_mode::answered (cognitive 20) corpus/fh/src/step_mode.rs:383 — corpus_fh::step_mode::answered has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 3 (9 pts), loops 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • corpus_fh::lsp_tools::client::read_message (cognitive 19) corpus/fh/src/lsp_tools/client.rs:371 — corpus_fh::lsp_tools::client::read_message has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 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.
  • corpus_fh::apply_patch_tool::patch::apply (cognitive 17) corpus/fh/src/apply_patch_tool/patch.rs:256 — corpus_fh::apply_patch_tool::patch::apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (7 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_fh::structured_compaction::structure (cognitive 17) corpus/fh/src/structured_compaction.rs:234 — corpus_fh::structured_compaction::structure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (8 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.
  • corpus_fh::early_tool_start::adopt (cognitive 16) corpus/fh/src/early_tool_start.rs:214 — corpus_fh::early_tool_start::adopt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 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.
  • corpus_fh::prompt_cache_shaping::first_change (cognitive 16) corpus/fh/src/prompt_cache_shaping.rs:300 — corpus_fh::prompt_cache_shaping::first_change has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 1 (2 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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×16
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×16
  • Edited copy of a member (5 corresponding lines) corpus/sn/src/tool_stats/stats.rs:150 — corpus/sn/src/tool_stats/stats.rs:150-159 | crates/rig-core/src/vector_store/in_memory_store.rs:333-337 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) plugins/rig-tui/src/input.rs:433 — plugins/rig-tui/src/input.rs:433-437 | plugins/rig-tui/src/input.rs:440-449 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/rig-core/src/operation/completion.rs:1656 — crates/rig-core/src/operation/completion.rs:1656-1660 | crates/rig-ecs/src/turn.rs:1488-1493 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/sn/src/watch_ai_comments.rs:423 — corpus/sn/src/watch_ai_comments.rs:423-427 | corpus/sp/src/inbox_folder.rs:486-492 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/rig-ecs/src/stage.rs:951 — crates/rig-ecs/src/stage.rs:951-955 | test-support/rig-harness-test-support/src/lib.rs:326-330 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/ct/src/conversation_chapters.rs:159 — corpus/ct/src/conversation_chapters.rs:159-163 | corpus/sn/src/bookmarks.rs:49-53 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/rig-core/src/providers/gemini/embedding.rs:75 — crates/rig-core/src/providers/gemini/embedding.rs:75-80 | crates/rig-gemini-grpc/src/embedding.rs:59-63 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/base/src/code_search_index.rs:1044 — corpus/base/src/code_search_index.rs:1044-1048 | corpus/ct/src/shell_companion.rs:280-284 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/base/src/map_reduce.rs:575 — corpus/base/src/map_reduce.rs:575-580 | corpus/sn/src/sessions_prune_cli.rs:630-634 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/fh/src/next_step_suggestions.rs:218 — corpus/fh/src/next_step_suggestions.rs:218-222 | corpus/oc/src/coverage_gap_nudge.rs:794-798 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/rig-core/src/serve/handler.rs:635 — crates/rig-core/src/serve/handler.rs:635-639 | crates/rig-core/src/tool/context.rs:302-306 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/ho/src/background_verify.rs:425 — corpus/ho/src/background_verify.rs:425-429 | corpus/oc/src/coverage_gap_nudge.rs:276-280 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/sn/src/vim_input/editor.rs:710 — corpus/sn/src/vim_input/editor.rs:710-714 | plugins/rig-tui/src/editor.rs:378-383 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) xtask/src/verify/extras.rs:111 — xtask/src/verify/extras.rs:111-117 | xtask/src/verify/guards.rs:303-307 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) corpus/fh/src/early_tool_start.rs:350 — corpus/fh/src/early_tool_start.rs:350-354 | corpus/ho/src/throughput_item.rs:166-170 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) test-support/rig-test-support/src/history_survival.rs:77 — test-support/rig-test-support/src/history_survival.rs:77-81 | test-support/rig-test-support/src/reasoning.rs:272-276 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · rig_core · ×15
  • rig_core::providers::openai::responses_api::input (cyclomatic 41) crates/rig-core/src/providers/openai/responses_api/mod.rs:142 — rig_core::providers::openai::responses_api::input 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.
  • rig_core::completion::history::user (cyclomatic 32) crates/rig-core/src/completion/history.rs:1553 — rig_core::completion::history::user 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.
  • rig_core::providers::anthropic::completion::strict_schema (cyclomatic 32) crates/rig-core/src/providers/anthropic/completion.rs:1356 — rig_core::providers::anthropic::completion::strict_schema 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.
  • rig_core::completion::history::assistant (cyclomatic 29) crates/rig-core/src/completion/history.rs:1211 — rig_core::completion::history::assistant 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.
  • rig_core::providers::internal::schema::sanitize_schema (cyclomatic 28) crates/rig-core/src/providers/internal/schema.rs:24 — rig_core::providers::internal::schema::sanitize_schema 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.
  • rig_core::providers::deepseek::strict_node (cyclomatic 26) crates/rig-core/src/providers/deepseek.rs:213 — rig_core::providers::deepseek::strict_node 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.
  • rig_core::providers::gemini::options::generate_content_options (cyclomatic 26) crates/rig-core/src/providers/gemini/options.rs:164 — rig_core::providers::gemini::options::generate_content_options 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.
  • rig_core::conversation::pairing::walk (cyclomatic 24) crates/rig-core/src/conversation/pairing.rs:461 — rig_core::conversation::pairing::walk 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.
  • rig_core::providers::anthropic::completion::apply_cache_control (cyclomatic 24) crates/rig-core/src/providers/anthropic/completion.rs:1023 — rig_core::providers::anthropic::completion::apply_cache_control 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.
  • rig_core::completion::options::merge::apply (cyclomatic 23) crates/rig-core/src/completion/options/merge.rs:875 — rig_core::completion::options::merge::apply 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.
  • rig_core::providers::openai::options::chat_options (cyclomatic 22) crates/rig-core/src/providers/openai/options.rs:481 — rig_core::providers::openai::options::chat_options 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.
  • rig_core::json_utils::parse_partial_object (cyclomatic 18) crates/rig-core/src/json_utils.rs:235 — rig_core::json_utils::parse_partial_object 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.
  • rig_core::providers::openai::wire::chat::document::merge_call (cyclomatic 17) crates/rig-core/src/providers/openai/wire/chat/document.rs:232 — rig_core::providers::openai::wire::chat::document::merge_call 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.
  • rig_core::completion::history::adapt_for (cyclomatic 16) crates/rig-core/src/completion/history.rs:618 — rig_core::completion::history::adapt_for 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.
  • rig_core::providers::anthropic::completion::base (cyclomatic 16) crates/rig-core/src/providers/anthropic/completion.rs:234 — rig_core::providers::anthropic::completion::base 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.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×15
  • Edited copy of a member (11 corresponding lines) corpus/fh/src/import_sessions.rs:484 — corpus/fh/src/import_sessions.rs:484-494 | corpus/oc/src/session_bundle.rs:538-549 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-core/src/providers/gemini/caching.rs:443 — crates/rig-core/src/providers/gemini/caching.rs:443-453 | crates/rig-core/src/providers/gemini/caching.rs:455-465 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/ho/src/tool_arg_repair/repair.rs:324 — corpus/ho/src/tool_arg_repair/repair.rs:324-336 | corpus/ho/src/tool_arg_repair/repair.rs:339-349 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-core/src/loaders/epub/loader.rs:250 — crates/rig-core/src/loaders/epub/loader.rs:250-261 | crates/rig-core/src/loaders/pdf.rs:257-267 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/fh/src/safety_judge.rs:459 — corpus/fh/src/safety_judge.rs:459-470 | corpus/sn/src/untrusted_quarantine.rs:532-542 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-core/src/providers/gemini/image_generation.rs:277 — crates/rig-core/src/providers/gemini/image_generation.rs:277-287 | crates/rig-core/src/providers/gemini/transcription.rs:114-124 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-http/src/http_client/erased.rs:228 — crates/rig-http/src/http_client/erased.rs:228-238 | crates/rig-http/src/http_client/erased.rs:247-259 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-cassette/src/scrub.rs:2557 — crates/rig-cassette/src/scrub.rs:2557-2570 | crates/rig-tools/src/edit.rs:569-579 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/sp/src/structured_config_edit.rs:429 — corpus/sp/src/structured_config_edit.rs:429-441 | corpus/sp/src/structured_config_edit.rs:476-486 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/ct/src/paste_chips.rs:692 — corpus/ct/src/paste_chips.rs:692-702 | plugins/rig-tui/src/view.rs:760-770 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-core/src/conversation/mod.rs:374 — crates/rig-core/src/conversation/mod.rs:374-385 | crates/rig-core/src/conversation/mod.rs:390-400 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/rig-core/src/providers/anthropic/modality.rs:66 — crates/rig-core/src/providers/anthropic/modality.rs:66-80 | crates/rig-core/src/providers/ollama/model_listing.rs:79-89 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/oc/src/line_provenance.rs:351 — corpus/oc/src/line_provenance.rs:351-361 | corpus/oc/src/message_ratings.rs:324-334 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) xtask/src/verify/extras.rs:303 — xtask/src/verify/extras.rs:303-313 | xtask/src/verify/guards.rs:572-586 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) corpus/base/src/output_truncate.rs:250 — corpus/base/src/output_truncate.rs:250-260 | crates/rig-core/src/providers/internal/wire_ids.rs:99-110 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×13
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×13
  • Edited copy of a member (6 corresponding lines) corpus/base/src/code_search_index.rs:492 — corpus/base/src/code_search_index.rs:492-497 | corpus/ho/src/repo_map.rs:471-476 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/base/src/http_api.rs:344 — corpus/base/src/http_api.rs:344-349 | corpus/ho/src/socket_attach.rs:398-408 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/base/src/code_search_index.rs:722 — corpus/base/src/code_search_index.rs:722-727 | corpus/sn/src/file_annotations.rs:291-296 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/ho/src/api_key_pool.rs:523 — corpus/ho/src/api_key_pool.rs:523-529 | corpus/oc/src/rate_limit_status.rs:269-274 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/ho/src/api_key_pool.rs:550 — corpus/ho/src/api_key_pool.rs:550-556 | corpus/oc/src/rate_limit_status.rs:294-299 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/rig-core/src/conversation/mod.rs:703 — crates/rig-core/src/conversation/mod.rs:703-708 | plugins/rig-tui/src/transcript.rs:1118-1123 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/rig-core/src/test_utils/trace_capture.rs:70 — crates/rig-core/src/test_utils/trace_capture.rs:70-77 | crates/rig-tools/src/overlay.rs:61-66 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/rig-harness/src/host/launcher.rs:390 — crates/rig-harness/src/host/launcher.rs:390-395 | crates/rig-harness/src/run.rs:301-306 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) test-support/rig-test-support/src/bank.rs:74 — test-support/rig-test-support/src/bank.rs:74-80 | xtask/src/cassette/shapes.rs:118-123 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/oc/src/issue_references.rs:399 — corpus/oc/src/issue_references.rs:399-404 | corpus/sn/src/terminal_sessions.rs:218-223 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/rf-06/src/main.rs:22 — corpus/rf-06/src/main.rs:22-27 | corpus/rf-07/src/bin/rerun.rs:11-16 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/rig-cassette/src/effect_log/jsonl.rs:987 — crates/rig-cassette/src/effect_log/jsonl.rs:987-992 | crates/rig-memory/src/dir.rs:143-148 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) corpus/sn/src/tool_stats.rs:128 — corpus/sn/src/tool_stats.rs:128-133 | plugins/rig-tui/src/input.rs:226-231 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×13
  • Duplicated block (9 lines × 2) corpus/ct/src/timed_grants.rs:502 — corpus/ct/src/timed_grants.rs:502-510 | plugins/rig-steel/src/harness.rs:336-344 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/timed_grants.rs:502` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) crates/rig-bedrock/src/options.rs:36 — crates/rig-bedrock/src/options.rs:36-44 | crates/rig-core/src/providers/anthropic/options.rs:33-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-bedrock/src/options.rs:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rig-bedrock/src/options.rs:45` calls `Some`, `Omit` and `crates/rig-core/src/providers/anthropic/options.rs:42` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) crates/rig-core/src/operation/completion.rs:1257 — crates/rig-core/src/operation/completion.rs:1257-1265 | test-support/rig-test-support/src/citations.rs:86-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/operation/completion.rs:1257` 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, `crates/rig-core/src/operation/completion.rs:1254` calls `Some`, `String`, `push_str` and `test-support/rig-test-support/src/citations.rs:85` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) crates/rig-core/src/providers/chatgpt/extension.rs:119 — crates/rig-core/src/providers/chatgpt/extension.rs:119-127 | crates/rig-core/src/providers/openai/extension/mod.rs:301-309 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/chatgpt/extension.rs:119` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rig-core/src/providers/openai/extension/mod.rs:310` calls `reply_field`, `default` and `crates/rig-core/src/providers/chatgpt/extension.rs:128` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) crates/rig-core/src/providers/gemini/image_generation.rs:279 — crates/rig-core/src/providers/gemini/image_generation.rs:279-287 | crates/rig-core/src/providers/gemini/transcription.rs:116-124 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/gemini/image_generation.rs:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `ImageGenerationRequest` in one and `transcription::TranscriptionRequest` 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 (9 lines × 2) crates/rig-rmcp/src/native.rs:184 — crates/rig-rmcp/src/native.rs:184-192 | crates/rig-sqlite/src/lib.rs:1278-1286 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) plugins/rig-basics/src/compaction.rs:1313 — plugins/rig-basics/src/compaction.rs:1313-1321 | plugins/rig-basics/src/compaction.rs:1435-1443 — both copies are in the same file, so extract the block into 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/rig-core/src/providers/anthropic/options.rs:317 — crates/rig-core/src/providers/anthropic/options.rs:317-325 | crates/rig-core/src/providers/openai/options.rs:1114-1122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/anthropic/options.rs:317` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) crates/rig-core/src/completion/request.rs:537 — crates/rig-core/src/completion/request.rs:537-545 | crates/rig-core/src/test_utils/streaming_conformance.rs:501-509 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) test-support/rig-test-support/src/reasoning.rs:291 — test-support/rig-test-support/src/reasoning.rs:291-299 | test-support/rig-test-support/src/reasoning.rs:377-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/rig-agent/src/test_utils/model_conformance.rs:1472 — crates/rig-agent/src/test_utils/model_conformance.rs:1472-1480 | crates/rig-agent/src/test_utils/model_conformance.rs:1486-1495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-agent/src/test_utils/model_conformance.rs:1472` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 2) test-support/rig-test-support/src/history_survival/adversarial.rs:34 — test-support/rig-test-support/src/history_survival/adversarial.rs:34-42 | test-support/rig-test-support/src/history_survival/sessions.rs:39-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `test-support/rig-test-support/src/history_survival/adversarial.rs:34` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/rig-core/src/test_utils/streaming_conformance.rs:906 — crates/rig-core/src/test_utils/streaming_conformance.rs:906-914 | crates/rig-core/src/test_utils/streaming_conformance.rs:995-1003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/test_utils/streaming_conformance.rs:906` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D2 · Cognitive Complexity · rig_tui · ×12
  • rig_tui::transcript::message_lines (cognitive 52) plugins/rig-tui/src/transcript.rs:1519 — rig_tui::transcript::message_lines has cognitive complexity 52 (threshold 15). Drivers by points: if/else 9 (26 pts), match/switch 6 (15 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tui::render::lay_out_transcript (cognitive 50) plugins/rig-tui/src/render.rs:653 — rig_tui::render::lay_out_transcript has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 8 (16 pts), match/switch 4 (8 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.
  • rig_tui::input::read_input (cognitive 33) plugins/rig-tui/src/input.rs:452 — rig_tui::input::read_input has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 4 (11 pts), boolean chains 6, 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.
  • rig_tui::pane::lay_out_panes (cognitive 32) plugins/rig-tui/src/pane.rs:210 — rig_tui::pane::lay_out_panes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tui::input::act (cognitive 31) plugins/rig-tui/src/input.rs:708 — rig_tui::input::act has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 6 (10 pts), boolean chains 2 (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.
  • rig_tui::editor::draw_editors (cognitive 24) plugins/rig-tui/src/editor.rs:746 — rig_tui::editor::draw_editors has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (9 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.
  • rig_tui::render::light_line (cognitive 21) plugins/rig-tui/src/render.rs:968 — rig_tui::render::light_line has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tui::input::run_keys (cognitive 20) plugins/rig-tui/src/input.rs:262 — rig_tui::input::run_keys has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tui::pick::queue_choices (cognitive 20) plugins/rig-tui/src/pick.rs:389 — rig_tui::pick::queue_choices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 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.
  • rig_tui::terminal::run_in_terminal (cognitive 19) plugins/rig-tui/src/terminal.rs:429 — rig_tui::terminal::run_in_terminal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tui::diff::changed_words (cognitive 18) plugins/rig-tui/src/diff.rs:249 — rig_tui::diff::changed_words has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 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.
  • rig_tui::render::draw_choice (cognitive 17) plugins/rig-tui/src/render.rs:1321 — rig_tui::render::draw_choice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · rig_ecs · ×12
  • rig_ecs::stage::start (cognitive 40) crates/rig-ecs/src/stage.rs:1186 — rig_ecs::stage::start has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::inbox::push_messages (cognitive 26) crates/rig-ecs/src/inbox.rs:739 — rig_ecs::inbox::push_messages has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 3 (8 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_ecs::restore::restore_session (cognitive 24) crates/rig-ecs/src/restore.rs:356 — rig_ecs::restore::restore_session has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 6 (8 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::tools::keep_within_parents (cognitive 24) crates/rig-ecs/src/tools.rs:481 — rig_ecs::tools::keep_within_parents has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::turn::take_unanswered (cognitive 24) crates/rig-ecs/src/turn.rs:441 — rig_ecs::turn::take_unanswered has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::restore::carry_on_restored (cognitive 22) crates/rig-ecs/src/restore.rs:636 — rig_ecs::restore::carry_on_restored has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 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.
  • rig_ecs::turn::stream_partials (cognitive 22) crates/rig-ecs/src/turn.rs:1358 — rig_ecs::turn::stream_partials has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (6 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.
  • rig_ecs::turn::commit_turn_calls (cognitive 18) crates/rig-ecs/src/turn.rs:1658 — rig_ecs::turn::commit_turn_calls has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::turn::commit_replies (cognitive 18) crates/rig-ecs/src/turn.rs:1960 — rig_ecs::turn::commit_replies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_ecs::turn::wait_in_order (cognitive 17) crates/rig-ecs/src/turn.rs:1926 — rig_ecs::turn::wait_in_order has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 1 (4 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.
  • rig_ecs::turn::stop_calls (cognitive 16) crates/rig-ecs/src/turn.rs:1610 — rig_ecs::turn::stop_calls has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (8 pts), if/else 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_ecs::turn::end_turns (cognitive 16) crates/rig-ecs/src/turn.rs:2006 — rig_ecs::turn::end_turns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corpus_base · ×12
  • corpus_base::export::render::walk (cognitive 26) corpus/base/src/export/render.rs:155 — corpus_base::export::render::walk has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (13 pts), match/switch 3 (7 pts), if/else 3 (6 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • corpus_base::window_gui::blocks_of (cognitive 25) corpus/base/src/window_gui.rs:409 — corpus_base::window_gui::blocks_of has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 5 (16 pts), loops 3 (7 pts), if/else 1 (2 pts) (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • corpus_base::tool_rate_limit::limit (cognitive 24) corpus/base/src/tool_rate_limit.rs:152 — corpus_base::tool_rate_limit::limit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_base::loop_breaker::judge (cognitive 22) corpus/base/src/loop_breaker.rs:114 — corpus_base::loop_breaker::judge has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_base::session_replay::answer_from_record (cognitive 22) corpus/base/src/session_replay.rs:1021 — corpus_base::session_replay::answer_from_record has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_base::debate::step (cognitive 21) corpus/base/src/debate.rs:359 — corpus_base::debate::step has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 pts), loops 1 (2 pts), match/switch 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • corpus_base::long_term_memory::recall (cognitive 19) corpus/base/src/long_term_memory.rs:388 — corpus_base::long_term_memory::recall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 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.
  • corpus_base::summarize_tool_output::summarize (cognitive 19) corpus/base/src/summarize_tool_output.rs:164 — corpus_base::summarize_tool_output::summarize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_base::http_api::server::read_request (cognitive 17) corpus/base/src/http_api/server.rs:282 — corpus_base::http_api::server::read_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 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.
  • corpus_base::share::render::render (cognitive 17) corpus/base/src/share/render.rs:21 — corpus_base::share::render::render has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (10 pts), loops 3 (7 pts) (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.
  • corpus_base::context_inspector::report (cognitive 16) corpus/base/src/context_inspector.rs:460 — corpus_base::context_inspector::report has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (5 pts), 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.
  • corpus_base::supervisor::count_calls (cognitive 16) corpus/base/src/supervisor.rs:298 — corpus_base::supervisor::count_calls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×12
  • Edited copy of a member (10 corresponding lines) corpus/base/src/long_term_memory.rs:564 — corpus/base/src/long_term_memory.rs:564-573 | corpus/base/src/long_term_memory.rs:587-599 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-core/src/effect/mod.rs:596 — crates/rig-core/src/effect/mod.rs:596-605 | crates/rig-core/src/effect/mod.rs:694-703 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) corpus/ct/src/ask_session_cli.rs:239 — corpus/ct/src/ask_session_cli.rs:239-248 | corpus/sp/src/commit_msg_hook.rs:148-158 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-core/src/completion/options/merge.rs:725 — crates/rig-core/src/completion/options/merge.rs:725-734 | plugins/rig-basics/src/compaction.rs:254-265 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-core/src/providers/anthropic/extension.rs:315 — crates/rig-core/src/providers/anthropic/extension.rs:315-324 | crates/rig-core/src/providers/anthropic/extension.rs:469-483 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-cassette/src/http/mod.rs:2979 — crates/rig-cassette/src/http/mod.rs:2979-2993 | xtask/src/cassette/bank.rs:511-520 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) plugins/rig-tui/src/renderers.rs:887 — plugins/rig-tui/src/renderers.rs:887-896 | plugins/rig-tui/src/renderers.rs:920-929 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) corpus/fh/src/standing_team.rs:395 — corpus/fh/src/standing_team.rs:395-404 | corpus/ct/src/shell_companion.rs:542-551 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-core/src/serve/adapters.rs:139 — crates/rig-core/src/serve/adapters.rs:139-148 | crates/rig-core/src/test_utils/relay.rs:43-52 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-core/src/providers/anthropic/completion.rs:1141 — crates/rig-core/src/providers/anthropic/completion.rs:1141-1150 | crates/rig-core/src/providers/openai/mod.rs:58-67 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-agent/src/test_utils/model_conformance.rs:429 — crates/rig-agent/src/test_utils/model_conformance.rs:429-438 | crates/rig-agent/src/test_utils/tools.rs:45-60 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/rig-agent/src/test_utils/model_conformance.rs:490 — crates/rig-agent/src/test_utils/model_conformance.rs:490-499 | crates/rig-agent/src/test_utils/tools.rs:145-160 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D2 · Cognitive Complexity · rig_claude_cloak · ×11
  • rig_claude_cloak::schema::upgrade (cognitive 102) plugins/rig-claude-cloak/src/schema.rs:634 — rig_claude_cloak::schema::upgrade has cognitive complexity 102 (threshold 15). Drivers by points: if/else 29 (78 pts), loops 5 (17 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • rig_claude_cloak::schema::postprocess (cognitive 58) plugins/rig-claude-cloak/src/schema.rs:465 — rig_claude_cloak::schema::postprocess has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (43 pts), boolean chains 8, loops 2 (6 pts), match/switch 1 (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.
  • rig_claude_cloak::transport::prompt_caching (cognitive 53) plugins/rig-claude-cloak/src/transport.rs:451 — rig_claude_cloak::transport::prompt_caching has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 15, loops 3 (4 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::transport::body (cognitive 53) plugins/rig-claude-cloak/src/transport.rs:625 — rig_claude_cloak::transport::body has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (36 pts), boolean chains 10, match/switch 4, 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.
  • rig_claude_cloak::schema::normalize (cognitive 34) plugins/rig-claude-cloak/src/schema.rs:121 — rig_claude_cloak::schema::normalize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 8, loops 4 (6 pts), match/switch 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::schema::strict_schema (cognitive 30) plugins/rig-claude-cloak/src/schema.rs:294 — rig_claude_cloak::schema::strict_schema has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 10, loops 4 (7 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::schema::empty_schemas (cognitive 27) plugins/rig-claude-cloak/src/schema.rs:573 — rig_claude_cloak::schema::empty_schemas has cognitive complexity 27 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 4 (10 pts), match/switch 1 (nesting depth added 16). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, 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.
  • rig_claude_cloak::transport::prefix_tools (cognitive 23) plugins/rig-claude-cloak/src/transport.rs:183 — rig_claude_cloak::transport::prefix_tools has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::transport::normalize_messages (cognitive 23) plugins/rig-claude-cloak/src/transport.rs:247 — rig_claude_cloak::transport::normalize_messages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::transport::first_user_text (cognitive 21) plugins/rig-claude-cloak/src/transport.rs:208 — rig_claude_cloak::transport::first_user_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_claude_cloak::schema::normalize_tools (cognitive 20) plugins/rig-claude-cloak/src/schema.rs:36 — rig_claude_cloak::schema::normalize_tools has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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 · rig_basics · ×11
  • rig_basics::compaction::compact_near_the_window (cognitive 56) plugins/rig-basics/src/compaction.rs:1234 — rig_basics::compaction::compact_near_the_window has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 3 (11 pts), boolean chains 7, loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_basics::print::drive (cognitive 41) plugins/rig-basics/src/print.rs:709 — rig_basics::print::drive has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 4 (10 pts), boolean chains 5, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_basics::reload::rebuild::drain_reload (cognitive 20) plugins/rig-basics/src/reload/rebuild.rs:194 — rig_basics::reload::rebuild::drain_reload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (8 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.
  • rig_basics::telemetry::usage::usage (cognitive 20) plugins/rig-basics/src/telemetry/usage.rs:439 — rig_basics::telemetry::usage::usage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (14 pts), match/switch 4, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rig_basics::redact::redact_parts (cognitive 19) plugins/rig-basics/src/redact.rs:696 — rig_basics::redact::redact_parts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 3 (9 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.
  • rig_basics::coding_tools::attach (cognitive 18) plugins/rig-basics/src/coding_tools.rs:299 — rig_basics::coding_tools::attach has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 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.
  • rig_basics::subagents::spawn::spawn_requested (cognitive 18) plugins/rig-basics/src/subagents/spawn.rs:217 — rig_basics::subagents::spawn::spawn_requested has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, match/switch 4, 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.
  • rig_basics::compaction::recover_from_overflow (cognitive 17) plugins/rig-basics/src/compaction.rs:1497 — rig_basics::compaction::recover_from_overflow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_basics::coding_tools::release (cognitive 16) plugins/rig-basics/src/coding_tools.rs:402 — rig_basics::coding_tools::release has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_basics::session_picker::preview (cognitive 16) plugins/rig-basics/src/session_picker.rs:634 — rig_basics::session_picker::preview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_basics::skills::discover (cognitive 16) plugins/rig-basics/src/skills.rs:139 — rig_basics::skills::discover has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 2 (6 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 · rig_cassette · ×11
  • rig_cassette::scrub::capture_format (cognitive 45) crates/rig-cassette/src/scrub.rs:526 — rig_cassette::scrub::capture_format has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (29 pts), boolean chains 16 (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.
  • rig_cassette::traffic::line::line (cognitive 44) crates/rig-cassette/src/traffic/line.rs:29 — rig_cassette::traffic::line::line has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (33 pts), match/switch 5 (8 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::scrub::multipart_slices (cognitive 37) crates/rig-cassette/src/scrub.rs:2922 — rig_cassette::scrub::multipart_slices has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 9, 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.
  • rig_cassette::http::replay_request (cognitive 26) crates/rig-cassette/src/http/mod.rs:1559 — rig_cassette::http::replay_request has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::http::proxy::drained (cognitive 20) crates/rig-cassette/src/http/proxy.rs:171 — rig_cassette::http::proxy::drained has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::scrub::mask_form_value (cognitive 20) crates/rig-cassette/src/scrub.rs:2421 — rig_cassette::scrub::mask_form_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::scrub::scrub_query_params_in_text (cognitive 19) crates/rig-cassette/src/scrub.rs:2058 — rig_cassette::scrub::scrub_query_params_in_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::scrub::url_spans (cognitive 18) crates/rig-cassette/src/scrub.rs:2516 — rig_cassette::scrub::url_spans 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.
  • rig_cassette::http::snapshot::apply_change (cognitive 17) crates/rig-cassette/src/http/snapshot.rs:466 — rig_cassette::http::snapshot::apply_change has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_cassette::scrub::parse_sse_chunks (cognitive 17) crates/rig-cassette/src/scrub.rs:2729 — rig_cassette::scrub::parse_sse_chunks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cassette::http::ledger::clean_up (cognitive 16) crates/rig-cassette/src/http/ledger.rs:517 — rig_cassette::http::ledger::clean_up has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), loops 2 (4 pts), boolean chains 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.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×11
  • Edited copy of a member (9 corresponding lines) corpus/sn/src/tool_stats.rs:235 — corpus/sn/src/tool_stats.rs:235-243 | plugins/rig-mcp-client/src/config.rs:480-493 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) corpus/base/src/http_api/server.rs:92 — corpus/base/src/http_api/server.rs:92-100 | corpus/ct/src/metrics_endpoint/server.rs:35-43 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) corpus/sn/src/task_queue.rs:343 — corpus/sn/src/task_queue.rs:343-351 | plugins/rig-basics/src/sessions/agents.rs:121-129 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/rig-memory/src/store.rs:433 — crates/rig-memory/src/store.rs:433-442 | crates/rig-memory/src/store.rs:444-452 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/rig-cassette/src/http/ledger.rs:204 — crates/rig-cassette/src/http/ledger.rs:204-212 | crates/rig-cassette/src/http/ledger.rs:217-230 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) corpus/ct/src/paste_chips.rs:178 — corpus/ct/src/paste_chips.rs:178-186 | corpus/ct/src/paste_chips.rs:189-197 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) corpus/ct/src/history_versions.rs:352 — corpus/ct/src/history_versions.rs:352-360 | crates/rig-tools/src/lib.rs:336-344 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/rig-core/src/providers/cohere/chat.rs:409 — crates/rig-core/src/providers/cohere/chat.rs:409-417 | crates/rig-core/src/providers/ollama/chat.rs:358-366 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) corpus/fh/src/safety_judge.rs:207 — corpus/fh/src/safety_judge.rs:207-216 | corpus/fh/src/structured_compaction.rs:220-228 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/rig-core/src/completion/message.rs:117 — crates/rig-core/src/completion/message.rs:117-125 | crates/rig-core/src/completion/request.rs:549-557 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/rig-core/src/providers/cohere/chat.rs:83 — crates/rig-core/src/providers/cohere/chat.rs:83-91 | crates/rig-core/src/providers/ollama/chat.rs:85-96 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×11
  • Outbound HTTP without resilience corpus/rf-01/src/main.rs:22 — `AgentBuilder::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience corpus/rf-06/src/lib.rs:271 — `AgentBuilder::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-agent/src/extractor.rs:118 — `AgentBuilder::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-cassette/src/http/ledger.rs:521 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-cassette/src/http/paths.rs:235 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-cassette/src/http/proxy.rs:249 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-helixdb/src/lib.rs:69 — `Client::builder()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-milvus/src/lib.rs:105 — `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-reqwest/src/lib.rs:133 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience crates/rig-vectorize/src/client/mod.rs:75 — `Client::new()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience plugins/rig-claude-cloak/src/transport/live.rs:249 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
AXH1 · Runtime security headers · Runtime security header not set · ×10
  • Runtime security header not set: content-security-policy — The live app's responses did not include content-security-policy (restricts the sources a page may load — mitigates XSS/injection). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-embedder-policy — The live app's responses did not include cross-origin-embedder-policy (recommended by the OWASP Secure Headers Project (value: require-corp)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-opener-policy — The live app's responses did not include cross-origin-opener-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-resource-policy — The live app's responses did not include cross-origin-resource-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: permissions-policy — The live app's responses did not include permissions-policy (restricts powerful browser features (camera, geolocation, …)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: referrer-policy — The live app's responses did not include referrer-policy (limits referrer leakage to third parties). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: strict-transport-security — The live app's responses did not include strict-transport-security (forces HTTPS on subsequent requests — mitigates downgrade/MITM). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-dns-prefetch-control — The live app's responses did not include x-dns-prefetch-control (recommended by the OWASP Secure Headers Project (value: off)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-frame-options — The live app's responses did not include x-frame-options (blocks clickjacking via framing (or use CSP frame-ancestors)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-permitted-cross-domain-policies — The live app's responses did not include x-permitted-cross-domain-policies (recommended by the OWASP Secure Headers Project (value: none)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
D1 · Cyclomatic Complexity · xtask · ×10
  • xtask::verify::execute::internal (cyclomatic 40) xtask/src/verify/execute.rs:40 — xtask::verify::execute::internal has cyclomatic complexity 40 (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.
  • xtask::driver_adoption::mask_literals_and_comments (cyclomatic 37) xtask/src/driver_adoption.rs:65 — xtask::driver_adoption::mask_literals_and_comments 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.
  • xtask::driver_adoption::macro_body (cyclomatic 31) xtask/src/driver_adoption.rs:558 — xtask::driver_adoption::macro_body 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.
  • xtask::cassette::scan::scan (cyclomatic 27) xtask/src/cassette/scan.rs:112 — xtask::cassette::scan::scan 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.
  • xtask::cassette::scan::key_shape (cyclomatic 21) xtask/src/cassette/scan.rs:38 — xtask::cassette::scan::key_shape 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.
  • xtask::catalog::pin (cyclomatic 21) xtask/src/catalog.rs:481 — xtask::catalog::pin 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.
  • xtask::catalog::guard::changes (cyclomatic 21) xtask/src/catalog/guard.rs:174 — xtask::catalog::guard::changes 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.
  • xtask::verify::plan::plan (cyclomatic 20) xtask/src/verify/plan.rs:180 — xtask::verify::plan::plan 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.
  • xtask::verify::preflight::run (cyclomatic 19) xtask/src/verify/preflight.rs:10 — xtask::verify::preflight::run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs (cyclomatic 16) xtask/src/driver_adoption.rs:730 — xtask::driver_adoption::streaming_modules_never_debug_print_wire_payloads_in_warn_logs 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 · corpus_ho · ×10
  • corpus_ho::session_recall::docs (cognitive 49) corpus/ho/src/session_recall.rs:475 — corpus_ho::session_recall::docs has cognitive complexity 49 (threshold 15). Drivers by points: match/switch 5 (25 pts), if/else 2 (12 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 37). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • corpus_ho::stale_read_elision::elide (cognitive 24) corpus/ho/src/stale_read_elision.rs:216 — corpus_ho::stale_read_elision::elide has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ho::hunk_review::revert (cognitive 23) corpus/ho/src/hunk_review.rs:378 — corpus_ho::hunk_review::revert has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, 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.
  • corpus_ho::working_set_carryover::track (cognitive 23) corpus/ho/src/working_set_carryover.rs:113 — corpus_ho::working_set_carryover::track has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ho::hunk_review::review (cognitive 20) corpus/ho/src/hunk_review.rs:454 — corpus_ho::hunk_review::review has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (8 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ho::dry_run::dry_run (cognitive 18) corpus/ho/src/dry_run.rs:348 — corpus_ho::dry_run::dry_run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, 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.
  • corpus_ho::stale_read_elision::stubs (cognitive 18) corpus/ho/src/stale_read_elision.rs:157 — corpus_ho::stale_read_elision::stubs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (7 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.
  • corpus_ho::conversation_surgery::plan_drop (cognitive 17) corpus/ho/src/conversation_surgery.rs:322 — corpus_ho::conversation_surgery::plan_drop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ho::submit_result::judge (cognitive 17) corpus/ho/src/submit_result.rs:255 — corpus_ho::submit_result::judge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ho::dry_run::preview (cognitive 16) corpus/ho/src/dry_run.rs:180 — corpus_ho::dry_run::preview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (4 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 · corpus_ct · ×10
  • corpus_ct::git_guardrails::shell::lex (cognitive 39) corpus/ct/src/git_guardrails/shell.rs:146 — corpus_ct::git_guardrails::shell::lex has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 4 (14 pts), loops 5 (13 pts), if/else 4 (11 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.
  • corpus_ct::status_command::clean (cognitive 33) corpus/ct/src/status_command.rs:460 — corpus_ct::status_command::clean has cognitive complexity 33 (threshold 15). Drivers by points: if/else 3 (16 pts), loops 3 (9 pts), match/switch 2 (5 pts), boolean chains 3 (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.
  • corpus_ct::git_history_tools::blamed (cognitive 26) corpus/ct/src/git_history_tools.rs:520 — corpus_ct::git_history_tools::blamed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 1 (3 pts), loops 2, 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.
  • corpus_ct::schema_adapter::schema::flatten (cognitive 24) corpus/ct/src/schema_adapter/schema.rs:161 — corpus_ct::schema_adapter::schema::flatten has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 4 (9 pts), loops 3 (7 pts), if/else 4 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ct::paste_chips::send_contents (cognitive 22) corpus/ct/src/paste_chips.rs:639 — corpus_ct::paste_chips::send_contents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ct::conversation_chapters::fold_in_requests (cognitive 20) corpus/ct/src/conversation_chapters.rs:887 — corpus_ct::conversation_chapters::fold_in_requests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_ct::reply_review_comments::comment (cognitive 19) corpus/ct/src/reply_review_comments.rs:350 — corpus_ct::reply_review_comments::comment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 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.
  • corpus_ct::process_reaper::after_turn (cognitive 17) corpus/ct/src/process_reaper.rs:345 — corpus_ct::process_reaper::after_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, 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.
  • corpus_ct::shell_companion::settled (cognitive 17) corpus/ct/src/shell_companion.rs:554 — corpus_ct::shell_companion::settled has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 6, loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • corpus_ct::provider_side_tools::note_provider_runs (cognitive 16) corpus/ct/src/provider_side_tools.rs:405 — corpus_ct::provider_side_tools::note_provider_runs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×10
  • Duplicated block (10 lines × 2) corpus/base/src/check_after_turn.rs:269 — corpus/base/src/check_after_turn.rs:269-278 | corpus/ho/src/background_verify.rs:259-268 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/check_after_turn.rs:269` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) corpus/base/src/custom_provider.rs:186 — corpus/base/src/custom_provider.rs:186-195 | corpus/ho/src/command_provider.rs:200-209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) corpus/ct/src/ask_session_cli/session.rs:210 — corpus/ct/src/ask_session_cli/session.rs:210-219 | crates/rig-memory/src/compaction.rs:1206-1215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/ask_session_cli/session.rs:210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) corpus/ct/src/process_reaper.rs:736 — corpus/ct/src/process_reaper.rs:736-745 | corpus/ct/src/process_reaper.rs:771-780 — both copies are in the same file, so extract the block into 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/rig-core/src/operation/completion.rs:873 — crates/rig-core/src/operation/completion.rs:873-882 | crates/rig-core/src/operation/completion.rs:929-938 — both copies are in the same file, so extract the block into 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/rig-milvus/src/lib.rs:188 — crates/rig-milvus/src/lib.rs:188-197 | crates/rig-milvus/src/lib.rs:229-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. The matched lines also transfer control out of the body holding them, 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, `crates/rig-milvus/src/lib.rs:227` calls `create_insert_request` and `crates/rig-milvus/src/lib.rs:186` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) corpus/base/src/output_truncate.rs:237 — corpus/base/src/output_truncate.rs:237-246 | corpus/base/src/summarize_tool_output.rs:324-333 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) crates/rig-tools/src/process.rs:335 — crates/rig-tools/src/process.rs:335-344 | crates/rig-tools/src/process.rs:413-422 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-tools/src/process.rs:335` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) test-support/rig-test-support/src/reasoning.rs:679 — test-support/rig-test-support/src/reasoning.rs:679-688 | test-support/rig-test-support/src/reasoning.rs:725-734 — both copies are in the same file, so extract the block into 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) test-support/rig-test-support/src/model_session.rs:1423 — test-support/rig-test-support/src/model_session.rs:1423-1432 | test-support/rig-test-support/src/model_session.rs:1523-1532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · MethodTooLong · ×9
  • MethodTooLong: StreamingTurnSource.run_model_turn crates/rig-agent/src/agent/engine.rs:865 — MethodTooLong — run_model_turn runs 257 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 157 over it, 2.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AgentRun.next_step crates/rig-agent/src/run/mod.rs:879 — MethodTooLong — next_step runs 166 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 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CacheBook.plan crates/rig-core/src/providers/gemini/caching.rs:769 — MethodTooLong — plan runs 129 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 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: QdrantFilter.interpret crates/rig-qdrant/src/filter.rs:137 — MethodTooLong — interpret runs 127 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 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PrintPlugin.finish plugins/rig-basics/src/print.rs:146 — MethodTooLong — finish runs 125 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 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Responses.base crates/rig-core/src/providers/openai/responses_api/mod.rs:469 — MethodTooLong — base runs 123 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 23 over it, 1.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.
  • MethodTooLong: OAuthTransport.prepare plugins/rig-claude-cloak/src/transport.rs:885 — MethodTooLong — prepare runs 118 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 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Stopper.stop crates/rig-ecs/src/turn.rs:674 — MethodTooLong — stop runs 117 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 17 over it, 1.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: SqliteVectorStore.add_rows_with_txn crates/rig-sqlite/src/lib.rs:578 — MethodTooLong — add_rows_with_txn runs 105 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 5 over it, 1.05× 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.
D3 · God Classes · TooManyMethods · ×9
  • TooManyMethods: AgentRun crates/rig-agent/src/run/mod.rs:309 — TooManyMethods — 71 methods. The bar is 30 methods; this is 41 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Conversation crates/rig-core/src/conversation/mod.rs:88 — TooManyMethods — 60 methods, declared across 2 files: conversation/mod.rs (57), conversation/turn.rs (3). The bar is 30 methods; this is 30 over it, 2.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Editor plugins/rig-tui/src/editor.rs:59 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AgentRunner crates/rig-agent/src/agent/runner.rs:54 — TooManyMethods — 49 methods, declared across 2 files: agent/runner.rs (45), agent/streaming.rs (4). 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: Scrubber crates/rig-cassette/src/scrub.rs:182 — TooManyMethods — 46 methods, declared across 2 files: src/scrub.rs (42), http/mod.rs (4). The bar is 30 methods; this is 16 over it, 1.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AgentBuilder crates/rig-agent/src/agent/builder.rs:115 — 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: OpenAIConfig crates/rig-core/src/providers/openai/wire.rs:593 — TooManyMethods — 42 methods, declared across 4 files: openai/wire.rs (24), wire/modality.rs (10), wire/auth.rs (6), client/openai.rs (2). The bar is 30 methods; this is 12 over it, 1.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CompletionRequest crates/rig-core/src/completion/request.rs:1272 — TooManyMethods — 39 methods, declared across 2 files: completion/request.rs (38), completion/prompt.rs (1). The bar is 30 methods; this is 9 over it, 1.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: ToolExecutionError crates/rig-core/src/tool/result.rs:136 — TooManyMethods — 32 methods, declared across 2 files: tool/result.rs (30), src/error.rs (2). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×9
  • Edited copy of a member (8 corresponding lines) corpus/library/src/transcript_import_library.rs:208 — corpus/library/src/transcript_import_library.rs:208-215 | corpus/oc/src/transcript_in_editor.rs:341-349 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) corpus/fh/src/rich_tool_rendering/looks.rs:208 — corpus/fh/src/rich_tool_rendering/looks.rs:208-216 | plugins/rig-basics/src/coding_tools/looks.rs:86-93 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/rig-memory/src/dir.rs:222 — crates/rig-memory/src/dir.rs:222-229 | crates/rig-memory/src/dir.rs:305-314 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/rig-cli/src/locks.rs:146 — crates/rig-cli/src/locks.rs:146-153 | crates/rig-harness-protocol/src/lib.rs:1105-1113 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/rig-core/src/providers/cohere/embeddings.rs:124 — crates/rig-core/src/providers/cohere/embeddings.rs:124-135 | crates/rig-core/src/providers/ollama/embedding.rs:97-104 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) corpus/base/src/prompt_templates.rs:337 — corpus/base/src/prompt_templates.rs:337-344 | corpus/sp/src/output_styles.rs:263-270 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) corpus/fh/src/correction_learner.rs:545 — corpus/fh/src/correction_learner.rs:545-552 | corpus/sn/src/tool_stats.rs:152-160 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/rig-core/src/providers/anthropic/streaming.rs:60 — crates/rig-core/src/providers/anthropic/streaming.rs:60-67 | crates/rig-core/src/providers/cohere/streaming.rs:77-85 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) corpus/oc/src/dataset_cli.rs:48 — corpus/oc/src/dataset_cli.rs:48-55 | corpus/sn/src/usage_report_cli.rs:31-39 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×9
  • Edited copy of a member (4 corresponding lines) crates/rig-qdrant/src/lib.rs:59 — crates/rig-qdrant/src/lib.rs:59-62 | crates/rig-scylladb/src/lib.rs:308-311 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/base/src/debate.rs:124 — corpus/base/src/debate.rs:124-127 | plugins/rig-tui/src/render.rs:1233-1236 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/rig-core/src/completion/message/citation.rs:201 — crates/rig-core/src/completion/message/citation.rs:201-204 | crates/rig-core/src/completion/message/native.rs:384-387 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/oc/src/dependency_guard.rs:489 — corpus/oc/src/dependency_guard.rs:489-492 | plugins/rig-basics/src/coding_tools/remote.rs:135-148 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/oc/src/message_ratings.rs:70 — corpus/oc/src/message_ratings.rs:70-73 | crates/rig-memory/src/compaction.rs:637-640 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/ho/src/blackboard.rs:405 — corpus/ho/src/blackboard.rs:405-409 | crates/rig-harness/src/host/launcher.rs:420-423 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/rig-core/src/driver.rs:381 — crates/rig-core/src/driver.rs:381-384 | crates/rig-core/src/driver/dyn_model.rs:164-167 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/base/src/context_inspector.rs:359 — corpus/base/src/context_inspector.rs:359-362 | corpus/ho/src/spend_by_origin.rs:124-127 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) corpus/base/src/todo_tracker.rs:151 — corpus/base/src/todo_tracker.rs:151-154 | corpus/rf-03/src/todo.rs:144-147 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D2 · Cognitive Complexity · corpus_sp · ×8
  • corpus_sp::dead_ends_ledger::review_shell (cognitive 32) corpus/sp/src/dead_ends_ledger.rs:367 — corpus_sp::dead_ends_ledger::review_shell has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sp::structured_config_edit::key::parse (cognitive 25) corpus/sp/src/structured_config_edit/key.rs:49 — corpus_sp::structured_config_edit::key::parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts), match/switch 2 (6 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.
  • corpus_sp::inbox_folder::take_changes (cognitive 24) corpus/sp/src/inbox_folder.rs:222 — corpus_sp::inbox_folder::take_changes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (5 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.
  • corpus_sp::inbox_folder::start_items (cognitive 22) corpus/sp/src/inbox_folder.rs:387 — corpus_sp::inbox_folder::start_items has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sp::structured_config_edit::yaml::key_of (cognitive 20) corpus/sp/src/structured_config_edit/yaml.rs:276 — corpus_sp::structured_config_edit::yaml::key_of has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • corpus_sp::output_styles::read_styles (cognitive 17) corpus/sp/src/output_styles.rs:205 — corpus_sp::output_styles::read_styles has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_sp::shell_env_policy::referenced (cognitive 16) corpus/sp/src/shell_env_policy.rs:493 — corpus_sp::shell_env_policy::referenced has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (7 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.
  • corpus_sp::subagent_result_cache::watch_effect (cognitive 16) corpus/sp/src/subagent_result_cache.rs:334 — corpus_sp::subagent_result_cache::watch_effect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×8
  • Edited copy of a member (14 corresponding lines) crates/rig-memory/src/tokens.rs:116 — crates/rig-memory/src/tokens.rs:116-130 | plugins/rig-tui/src/pick.rs:874-887 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) corpus/ho/src/raw_stream_log.rs:421 — corpus/ho/src/raw_stream_log.rs:421-438 | corpus/ho/src/raw_stream_log.rs:456-469 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) plugins/rig-tui/src/editor.rs:336 — plugins/rig-tui/src/editor.rs:336-349 | plugins/rig-tui/src/editor.rs:352-365 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/rig-core/src/loaders/epub/loader.rs:110 — crates/rig-core/src/loaders/epub/loader.rs:110-123 | crates/rig-core/src/loaders/epub/loader.rs:143-156 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/rig-core/src/completion/message.rs:497 — crates/rig-core/src/completion/message.rs:497-510 | crates/rig-core/src/completion/message.rs:536-549 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/rig-milvus/src/lib.rs:251 — crates/rig-milvus/src/lib.rs:251-265 | crates/rig-milvus/src/lib.rs:271-284 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/rig-core/src/test_utils/streaming_conformance.rs:1736 — crates/rig-core/src/test_utils/streaming_conformance.rs:1736-1753 | crates/rig-core/src/test_utils/streaming_conformance.rs:2125-2138 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) test-support/rig-test-support/src/history_survival/sessions.rs:154 — test-support/rig-test-support/src/history_survival/sessions.rs:154-167 | test-support/rig-test-support/src/support.rs:341-356 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×8
  • Edited copy of a member (13 corresponding lines) corpus/base/src/supervisor.rs:493 — corpus/base/src/supervisor.rs:493-505 | corpus/fh/src/checklist_runner.rs:832-844 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) corpus/base/src/auto_commit.rs:522 — corpus/base/src/auto_commit.rs:522-537 | corpus/fh/src/dirty_tree_guard.rs:150-162 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/rig-core/src/catalog/lookup.rs:72 — crates/rig-core/src/catalog/lookup.rs:72-85 | xtask/src/catalog.rs:815-827 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) xtask/src/verify/extras.rs:89 — xtask/src/verify/extras.rs:89-101 | xtask/src/verify/guards.rs:172-185 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) corpus/base/src/share/render.rs:123 — corpus/base/src/share/render.rs:123-135 | crates/rig-core/src/providers/internal/auth/loopback.rs:492-505 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) corpus/fh/src/editor_front.rs:730 — corpus/fh/src/editor_front.rs:730-746 | corpus/oc/src/ask_parent.rs:427-439 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/rig-core/src/operation/verify.rs:71 — crates/rig-core/src/operation/verify.rs:71-83 | crates/rig-core/src/providers/gemini/cached_content.rs:47-62 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) test-support/rig-test-support/src/matrix/agent_tool_sessions.rs:205 — test-support/rig-test-support/src/matrix/agent_tool_sessions.rs:205-217 | test-support/rig-test-support/src/matrix/agent_tool_sessions.rs:220-232 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D5 · Coupling · Off the main sequence · ×8
  • Off the main sequence: rig-harness-protocol — rig-harness-protocol: 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: rig-tools — rig-tools: abstractness 0.01, instability 0.10, distance 0.89 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
  • Off the main sequence: rig-markdown — rig-markdown: abstractness 0.14, instability 0.00, distance 0.86 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: rig-core — rig-core: abstractness 0.06, instability 0.09, distance 0.85 — zone of pain — concrete and depended on by 42 project(s), so it's rigid to change.
  • Off the main sequence: rig-memory — rig-memory: abstractness 0.10, instability 0.06, distance 0.84 — zone of pain — concrete and depended on by 16 project(s), so it's rigid to change.
  • Off the main sequence: rig-http — rig-http: abstractness 0.25, instability 0.00, distance 0.75 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
  • Off the main sequence: rig-reqwest — rig-reqwest: abstractness 0.17, instability 0.09, distance 0.74 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: rig-ecs — rig-ecs: abstractness 0.01, instability 0.25, distance 0.74 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
D6 · Cohesion (LCOM4) · Low cohesion · ×8
  • Low cohesion: ModelSpec (LCOM4 7) crates/rig-core/src/catalog/spec.rs:44 — ModelSpec's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Messages (LCOM4 7) crates/rig-core/src/providers/anthropic/wire.rs:507 — Messages's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CompletionRequest (LCOM4 6) crates/rig-core/src/completion/request.rs:1272 — CompletionRequest'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: NewCachedContent (LCOM4 5) crates/rig-core/src/providers/gemini/cached_content.rs:94 — NewCachedContent's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BedrockRuntime (LCOM4 4) crates/rig-bedrock/src/client.rs:59 — BedrockRuntime's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Responses (LCOM4 4) crates/rig-core/src/providers/openai/responses_api/wire.rs:24 — Responses's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Descriptor (LCOM4 4) crates/rig-core/src/wire.rs:437 — Descriptor's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ReqwestClient (LCOM4 4) crates/rig-reqwest/src/lib.rs:51 — ReqwestClient's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D1 · Cyclomatic Complexity · rig_tui · ×7
  • rig_tui::input::act (cyclomatic 50) plugins/rig-tui/src/input.rs:708 — rig_tui::input::act has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • rig_tui::render::lay_out_transcript (cyclomatic 29) plugins/rig-tui/src/render.rs:653 — rig_tui::render::lay_out_transcript 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.
  • rig_tui::transcript::message_lines (cyclomatic 27) plugins/rig-tui/src/transcript.rs:1519 — rig_tui::transcript::message_lines 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.
  • rig_tui::input::read_input (cyclomatic 26) plugins/rig-tui/src/input.rs:452 — rig_tui::input::read_input 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.
  • rig_tui::pane::lay_out_panes (cyclomatic 20) plugins/rig-tui/src/pane.rs:210 — rig_tui::pane::lay_out_panes 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.
  • rig_tui::render::draw_choice (cyclomatic 18) plugins/rig-tui/src/render.rs:1321 — rig_tui::render::draw_choice 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.
  • rig_tui::pick::queue_choices (cyclomatic 17) plugins/rig-tui/src/pick.rs:389 — rig_tui::pick::queue_choices has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rig_tui::pick::choice_key (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · corpus_sn · ×7
  • corpus_sn::vim_input::editor::parse (cyclomatic 29) corpus/sn/src/vim_input/editor.rs:409 — corpus_sn::vim_input::editor::parse has cyclomatic complexity 29 (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.
  • corpus_sn::crash_resume::recover (cyclomatic 20) corpus/sn/src/crash_resume.rs:207 — corpus_sn::crash_resume::recover 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.
  • corpus_sn::model_params::check (cyclomatic 18) corpus/sn/src/model_params.rs:342 — corpus_sn::model_params::check 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.
  • corpus_sn::vim_input::edit (cyclomatic 18) corpus/sn/src/vim_input.rs:145 — corpus_sn::vim_input::edit 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.
  • corpus_sn::crash_resume::resolve (cyclomatic 17) corpus/sn/src/crash_resume.rs:417 — corpus_sn::crash_resume::resolve 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.
  • corpus_sn::vim_input::editor::target (cyclomatic 17) corpus/sn/src/vim_input/editor.rs:561 — corpus_sn::vim_input::editor::target 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.
  • corpus_sn::sessions_prune_cli::plan (cyclomatic 16) corpus/sn/src/sessions_prune_cli.rs:341 — corpus_sn::sessions_prune_cli::plan has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · rig_tools · ×7
  • rig_tools::watch::send_batches (cognitive 49) crates/rig-tools/src/watch.rs:690 — rig_tools::watch::send_batches has cognitive complexity 49 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 7 (17 pts), match/switch 4 (10 pts), boolean chains 4 (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.
  • rig_tools::process::forward_both (cognitive 38) crates/rig-tools/src/process.rs:356 — rig_tools::process::forward_both has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 5 (11 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tools::edit::apply_to (cognitive 29) crates/rig-tools/src/edit.rs:459 — rig_tools::edit::apply_to has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 2 (3 pts), 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.
  • rig_tools::search::find (cognitive 27) crates/rig-tools/src/search.rs:322 — rig_tools::search::find has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (5 pts), boolean chains 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.
  • rig_tools::edit::around (cognitive 22) crates/rig-tools/src/edit.rs:223 — rig_tools::edit::around has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tools::attach::attachments (cognitive 19) crates/rig-tools/src/attach.rs:235 — rig_tools::attach::attachments has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_tools::read::show (cognitive 16) crates/rig-tools/src/read.rs:352 — rig_tools::read::show has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · ClassTooLong · ×7
  • ClassTooLong: Scrubber crates/rig-cassette/src/scrub.rs:182 — ClassTooLong — 911 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 46 methods, 2 blocks, lines 182-1945. The bar is 400 significant lines; this is 511 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: AgentRun crates/rig-agent/src/run/mod.rs:309 — ClassTooLong — 839 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 71 methods, 4 blocks, lines 309-1870. The bar is 400 significant lines; this is 439 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Conversation crates/rig-core/src/conversation/mod.rs:88 — 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), 60 methods, 4 blocks, lines 88-1419. 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: ReplyFold crates/rig-core/src/operation/completion.rs:258 — ClassTooLong — 526 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, 3 blocks, lines 258-1326. The bar is 400 significant lines; this is 126 over it, 1.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatDecoder crates/rig-core/src/providers/openai/wire/chat.rs:1171 — ClassTooLong — 429 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 4 blocks, lines 1171-1928. The bar is 400 significant lines; this is 29 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Chat crates/rig-core/src/providers/openai/wire/chat.rs:41 — ClassTooLong — 411 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 4 blocks, lines 41-1013. The bar is 400 significant lines; this is 11 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.
  • ClassTooLong: Job corpus/fh/src/lsp_tools.rs:392 — ClassTooLong — 404 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 2 blocks, lines 392-945. The bar is 400 significant lines; this is 4 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×7
  • Edited copy of a member (12 corresponding lines) crates/rig-core/src/providers/cohere/streaming/document.rs:42 — crates/rig-core/src/providers/cohere/streaming/document.rs:42-53 | crates/rig-core/src/providers/ollama/streaming/document.rs:35-54 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) corpus/fh/src/editor_front.rs:1002 — corpus/fh/src/editor_front.rs:1002-1017 | corpus/fh/src/editor_front.rs:1020-1031 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) corpus/fh/src/dirty_tree_guard.rs:91 — corpus/fh/src/dirty_tree_guard.rs:91-105 | corpus/sn/src/web_fetch/policy.rs:43-54 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) corpus/ct/src/turn_navigation.rs:193 — corpus/ct/src/turn_navigation.rs:193-206 | corpus/oc/src/message_ratings.rs:206-217 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) corpus/sp/src/changelog_fragments.rs:584 — corpus/sp/src/changelog_fragments.rs:584-595 | corpus/sp/src/output_styles.rs:301-312 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/rig-candle/src/validation.rs:812 — crates/rig-candle/src/validation.rs:812-824 | crates/rig-candle/src/validation.rs:830-841 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) test-support/rig-test-support/src/history_survival/adversarial.rs:31 — test-support/rig-test-support/src/history_survival/adversarial.rs:31-42 | test-support/rig-test-support/src/history_survival/sessions.rs:36-48 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · rig_claude_cloak · ×6
  • rig_claude_cloak::transport::body (cyclomatic 44) plugins/rig-claude-cloak/src/transport.rs:625 — rig_claude_cloak::transport::body 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.
  • rig_claude_cloak::schema::upgrade (cyclomatic 39) plugins/rig-claude-cloak/src/schema.rs:634 — rig_claude_cloak::schema::upgrade 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.
  • rig_claude_cloak::transport::prompt_caching (cyclomatic 39) plugins/rig-claude-cloak/src/transport.rs:451 — rig_claude_cloak::transport::prompt_caching 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.
  • rig_claude_cloak::schema::normalize (cyclomatic 28) plugins/rig-claude-cloak/src/schema.rs:121 — rig_claude_cloak::schema::normalize has cyclomatic complexity 28 (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.
  • rig_claude_cloak::schema::postprocess (cyclomatic 26) plugins/rig-claude-cloak/src/schema.rs:465 — rig_claude_cloak::schema::postprocess 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.
  • rig_claude_cloak::schema::strict_schema (cyclomatic 24) plugins/rig-claude-cloak/src/schema.rs:294 — rig_claude_cloak::schema::strict_schema has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · corpus_fh · ×6
  • corpus_fh::editor_front::receive (cyclomatic 32) corpus/fh/src/editor_front.rs:542 — corpus_fh::editor_front::receive 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.
  • corpus_fh::import_sessions::parse::claude_code (cyclomatic 20) corpus/fh/src/import_sessions/parse.rs:299 — corpus_fh::import_sessions::parse::claude_code 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.
  • corpus_fh::apply_patch_tool::patch::parse (cyclomatic 19) corpus/fh/src/apply_patch_tool/patch.rs:162 — corpus_fh::apply_patch_tool::patch::parse 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.
  • corpus_fh::prompt_cache_shaping::shape (cyclomatic 19) corpus/fh/src/prompt_cache_shaping.rs:143 — corpus_fh::prompt_cache_shaping::shape 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.
  • corpus_fh::apply_patch_tool::patch::check (cyclomatic 18) corpus/fh/src/apply_patch_tool/patch.rs:50 — corpus_fh::apply_patch_tool::patch::check 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.
  • corpus_fh::apply_patch_tool::gate_together (cyclomatic 17) corpus/fh/src/apply_patch_tool.rs:321 — corpus_fh::apply_patch_tool::gate_together 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.
D2 · Cognitive Complexity · Scrubber · ×6
  • Scrubber::scrub_sse_body (cognitive 41) crates/rig-cassette/src/scrub.rs:1496 — Scrubber::scrub_sse_body has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Scrubber::scrub_json_in (cognitive 40) crates/rig-cassette/src/scrub.rs:1660 — Scrubber::scrub_json_in has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 4 (10 pts), boolean chains 7, match/switch 1 (nesting depth added 16). 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.
  • Scrubber::learn_json_in (cognitive 29) crates/rig-cassette/src/scrub.rs:1302 — Scrubber::learn_json_in has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (7 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Scrubber::learn_body_parts (cognitive 20) crates/rig-cassette/src/scrub.rs:864 — Scrubber::learn_body_parts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts), 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.
  • Scrubber::learn_header (cognitive 19) crates/rig-cassette/src/scrub.rs:1176 — Scrubber::learn_header has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Scrubber::scrub_text (cognitive 17) crates/rig-cassette/src/scrub.rs:1754 — Scrubber::scrub_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3, 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.
D1 · Cyclomatic Complexity · rig_basics · ×5
  • rig_basics::compaction::compact_near_the_window (cyclomatic 28) plugins/rig-basics/src/compaction.rs:1234 — rig_basics::compaction::compact_near_the_window 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.
  • rig_basics::print::drive (cyclomatic 28) plugins/rig-basics/src/print.rs:709 — rig_basics::print::drive 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.
  • rig_basics::telemetry::usage::usage (cyclomatic 24) plugins/rig-basics/src/telemetry/usage.rs:439 — rig_basics::telemetry::usage::usage 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.
  • rig_basics::reload::rebuild::drain_reload (cyclomatic 20) plugins/rig-basics/src/reload/rebuild.rs:194 — rig_basics::reload::rebuild::drain_reload 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.
  • rig_basics::subagents::spawn::spawn_requested (cyclomatic 18) plugins/rig-basics/src/subagents/spawn.rs:217 — rig_basics::subagents::spawn::spawn_requested 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.
D2 · Cognitive Complexity · rig_cli · ×5
  • rig_cli::run::run_agent (cognitive 93) crates/rig-cli/src/run.rs:281 — rig_cli::run::run_agent has cognitive complexity 93 (threshold 15). Drivers by points: if/else 26 (68 pts), match/switch 6 (15 pts), loops 3 (6 pts), boolean chains 4 (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.
  • rig_cli::locks::sweep (cognitive 29) crates/rig-cli/src/locks.rs:61 — rig_cli::locks::sweep has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cli::project::manifest (cognitive 21) crates/rig-cli/src/project.rs:285 — rig_cli::project::manifest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cli::plugin::listing (cognitive 19) crates/rig-cli/src/plugin.rs:199 — rig_cli::plugin::listing has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_cli::run::unfollowed (cognitive 17) crates/rig-cli/src/run.rs:710 — rig_cli::run::unfollowed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_candle · ×5
  • rig_candle::protocol::render_qwen_message (cognitive 69) crates/rig-candle/src/protocol.rs:518 — rig_candle::protocol::render_qwen_message has cognitive complexity 69 (threshold 15). Drivers by points: if/else 10 (38 pts), match/switch 6 (20 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 47). 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.
  • rig_candle::protocol::validate_protocol_inputs (cognitive 29) crates/rig-candle/src/protocol.rs:97 — rig_candle::protocol::validate_protocol_inputs has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 4 (16 pts), loops 5 (13 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • rig_candle::protocol::render_qwen3 (cognitive 24) crates/rig-candle/src/protocol.rs:410 — rig_candle::protocol::render_qwen3 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (11 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.
  • rig_candle::protocol::parse_qwen3_assistant (cognitive 22) crates/rig-candle/src/protocol.rs:690 — rig_candle::protocol::parse_qwen3_assistant has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, 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.
  • rig_candle::validation::validate_model_config (cognitive 17) crates/rig-candle/src/validation.rs:40 — rig_candle::validation::validate_model_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 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 · corpus_library · ×5
  • corpus_library::transcript_import_library::import (cognitive 42) corpus/library/src/transcript_import_library.rs:229 — corpus_library::transcript_import_library::import has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 5 (12 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • corpus_library::session_edit_library::conversation_markdown (cognitive 30) corpus/library/src/session_edit_library.rs:735 — corpus_library::session_edit_library::conversation_markdown has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 4 (15 pts), if/else 3 (8 pts), loops 3 (7 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • corpus_library::session_compare_library::excerpt (cognitive 20) corpus/library/src/session_compare_library.rs:287 — corpus_library::session_compare_library::excerpt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (8 pts) (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.
  • corpus_library::session_compare_library::render (cognitive 16) corpus/library/src/session_compare_library.rs:343 — corpus_library::session_compare_library::render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (4 pts), match/switch 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.
  • corpus_library::session_edit_library::save (cognitive 16) corpus/library/src/session_edit_library.rs:585 — corpus_library::session_edit_library::save has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 4 (6 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.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: lib.rs ↔ lib.rs crates/rig-postgres/src/lib.rs:1 — `crates/rig-postgres/src/lib.rs` and `crates/rig-scylladb/src/lib.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 — 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 `bdd1d756` refactor(vector_store)!: tighten the VectorSearchRequest surface (#2683); `f42a7665` refactor(vector-stores)!: drop forwarding layers in vector-store crat…; `10ecfd80` fix: honour the WASM bounds in every vector store (#2545) — run `git show` on any of them.
  • Change coupling: lib.rs ↔ lib.rs crates/rig-scylladb/src/lib.rs:1 — `crates/rig-scylladb/src/lib.rs` and `crates/rig-surrealdb/src/lib.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 — 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 `bdd1d756` refactor(vector_store)!: tighten the VectorSearchRequest surface (#2683); `f42a7665` refactor(vector-stores)!: drop forwarding layers in vector-store crat…; `10ecfd80` fix: honour the WASM bounds in every vector store (#2545) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ streaming.rs crates/rig-core/src/providers/copilot/mod.rs:1 — `crates/rig-core/src/providers/copilot/mod.rs` and `crates/rig-core/src/providers/openai/responses_api/streaming.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 — 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 `f885c206` refactor(telemetry): centralize completion span lifecycle (#2115); `73a39fcb` feat(openai): expose complete Responses reasoning metadata (#2112); `02b81bd8` feat(openai): support GPT-5.6 models and reasoning controls (#2106) — run `git show` on any of them.
  • Change coupling: lib.rs ↔ lib.rs crates/rig-lancedb/src/lib.rs:1 — `crates/rig-lancedb/src/lib.rs` and `crates/rig-surrealdb/src/lib.rs` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `10ecfd80` fix: honour the WASM bounds in every vector store (#2545); `235e3838` refactor: ownership sweep round 4 — avoidable clones, dead public ite…; `9b903e18` feat: improve vector store documentation and filter ergonomics (break… (at that commit the files were still `rig-integrations/rig-lancedb/src/lib.rs` and `rig-integrations/rig-surrealdb/src/lib.rs`) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ ollama.rs crates/rig-core/src/providers/gemini/interactions_api/mod.rs:1 — `crates/rig-core/src/providers/gemini/interactions_api/mod.rs` and `crates/rig-core/src/providers/ollama.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `7d30a176` refactor: share the tool-id spelling loop across request builders (#2…; `897e6275` refactor: consolidate provider schema/normalization and agent plumbin…; `2c22e181` cleanup: post-Vec-migration precision and the pre-Vec serde accommoda… — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×5
  • Edited copy of a member (18 corresponding lines) corpus/ct/src/ask_session_cli.rs:256 — corpus/ct/src/ask_session_cli.rs:256-273 | corpus/sp/src/commit_msg_hook.rs:244-261 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) corpus/rf-04/src/lib.rs:399 — corpus/rf-04/src/lib.rs:399-416 | corpus/shared/src/confirm_destructive.rs:161-182 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/rig-core/src/vector_store/in_memory_store.rs:413 — crates/rig-core/src/vector_store/in_memory_store.rs:413-433 | crates/rig-core/src/vector_store/in_memory_store.rs:438-455 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/rig-core/src/providers/chatgpt/auth/mod.rs:150 — crates/rig-core/src/providers/chatgpt/auth/mod.rs:150-167 | crates/rig-core/src/providers/copilot/auth/mod.rs:133-151 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) test-support/rig-test-support/src/comparison_guard.rs:152 — test-support/rig-test-support/src/comparison_guard.rs:152-173 | test-support/rig-test-support/src/comparison_guard.rs:178-195 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×5
  • Edited copy of a member (16 corresponding lines) crates/rig-core/src/tool/validate.rs:477 — crates/rig-core/src/tool/validate.rs:477-492 | test-support/rig-history-conformance/src/lib.rs:714-732 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) corpus/base/src/export/render.rs:369 — corpus/base/src/export/render.rs:369-387 | corpus/fh/src/encrypted_sessions/reseal.rs:64-79 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) corpus/base/src/auto_commit.rs:488 — corpus/base/src/auto_commit.rs:488-503 | corpus/fh/src/open_pr.rs:1038-1054 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) corpus/library/src/session_edit_library.rs:324 — corpus/library/src/session_edit_library.rs:324-339 | corpus/oc/src/transcript_in_editor.rs:612-627 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) corpus/base/src/auto_commit.rs:189 — corpus/base/src/auto_commit.rs:189-204 | corpus/sn/src/watch_ai_comments.rs:456-471 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · rig_cassette · ×4
  • rig_cassette::scrub::capture_format (cyclomatic 36) crates/rig-cassette/src/scrub.rs:526 — rig_cassette::scrub::capture_format has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • rig_cassette::traffic::line::line (cyclomatic 28) crates/rig-cassette/src/traffic/line.rs:29 — rig_cassette::traffic::line::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.
  • rig_cassette::scrub::multipart_slices (cyclomatic 24) crates/rig-cassette/src/scrub.rs:2922 — rig_cassette::scrub::multipart_slices 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.
  • rig_cassette::http::replay_request (cyclomatic 18) crates/rig-cassette/src/http/mod.rs:1559 — rig_cassette::http::replay_request 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 · corpus_oc · ×4
  • corpus_oc::steer_and_queue::strip_keys (cyclomatic 25) corpus/oc/src/steer_and_queue.rs:404 — corpus_oc::steer_and_queue::strip_keys 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.
  • corpus_oc::transcript_in_editor::rebuild (cyclomatic 21) corpus/oc/src/transcript_in_editor.rs:492 — corpus_oc::transcript_in_editor::rebuild 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.
  • corpus_oc::dataset_cli::dataset::chat_messages (cyclomatic 20) corpus/oc/src/dataset_cli/dataset.rs:395 — corpus_oc::dataset_cli::dataset::chat_messages 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.
  • corpus_oc::dataset_cli::dataset::session_lines (cyclomatic 16) corpus/oc/src/dataset_cli/dataset.rs:175 — corpus_oc::dataset_cli::dataset::session_lines 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 · rig_ecs · ×4
  • rig_ecs::stage::start (cyclomatic 24) crates/rig-ecs/src/stage.rs:1186 — rig_ecs::stage::start 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.
  • rig_ecs::turn::commit_turn_calls (cyclomatic 17) crates/rig-ecs/src/turn.rs:1658 — rig_ecs::turn::commit_turn_calls 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.
  • rig_ecs::restore::restore_session (cyclomatic 16) crates/rig-ecs/src/restore.rs:356 — rig_ecs::restore::restore_session 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.
  • rig_ecs::turn::take_unanswered (cyclomatic 16) crates/rig-ecs/src/turn.rs:441 — rig_ecs::turn::take_unanswered 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 · rig_memory · ×4
  • rig_memory::rewrite::map_file (cognitive 26) crates/rig-memory/src/rewrite.rs:339 — rig_memory::rewrite::map_file has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 4 (11 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.
  • rig_memory::conformance::races (cognitive 25) crates/rig-memory/src/conformance.rs:276 — rig_memory::conformance::races has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (4 pts), match/switch 2 (4 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.
  • rig_memory::rewrite::rewrite (cognitive 25) crates/rig-memory/src/rewrite.rs:628 — rig_memory::rewrite::rewrite has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 8, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_memory::rewrite::map_state (cognitive 19) crates/rig-memory/src/rewrite.rs:556 — rig_memory::rewrite::map_state has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 11+ corresponding lines) corpus/base/src/http_api.rs:355 — corpus/base/src/http_api.rs:355-365 | corpus/ho/src/socket_attach.rs:436-447 | corpus/ho/src/socket_attach.rs:453-465 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) corpus/base/src/check_after_turn.rs:188 — corpus/base/src/check_after_turn.rs:188-199 | corpus/sn/src/server_side_state.rs:238-248 | corpus/sp/src/changelog_fragments.rs:207-217 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/rig-core/src/providers/anthropic/wire.rs:709 — crates/rig-core/src/providers/anthropic/wire.rs:709-724 | crates/rig-core/src/providers/openai/responses_api/wire.rs:124-134 | crates/rig-core/src/providers/openai/wire/chat.rs:738-748 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/rig-core/src/providers/cohere/embeddings.rs:44 — crates/rig-core/src/providers/cohere/embeddings.rs:44-55 | crates/rig-core/src/providers/ollama/embedding.rs:58-68 | crates/rig-core/src/providers/voyageai/wire.rs:71-84 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×4
  • Duplicated block (12 lines × 2) corpus/ct/src/schema_adapter/schema.rs:380 — corpus/ct/src/schema_adapter/schema.rs:380-391 | corpus/sn/src/web_fetch/policy.rs:126-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/schema_adapter/schema.rs:380` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) corpus/fh/src/next_step_suggestions.rs:321 — corpus/fh/src/next_step_suggestions.rs:321-332 | plugins/rig-tui/src/keys.rs:675-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. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/fh/src/next_step_suggestions.rs:321` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) corpus/ho/src/conversation_surgery.rs:50 — corpus/ho/src/conversation_surgery.rs:50-61 | corpus/library/src/session_edit_library.rs:463-474 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) corpus/oc/src/dataset_cli/dataset.rs:160 — corpus/oc/src/dataset_cli/dataset.rs:160-171 | corpus/sn/src/usage_report_cli/report.rs:284-295 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×4
  • Duplicated block (11 lines × 2) crates/rig-ecs/src/turn.rs:1406 — crates/rig-ecs/src/turn.rs:1406-1416 | crates/rig-ecs/src/turn.rs:1467-1477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-ecs/src/turn.rs:1406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/rig-postgres/src/memory.rs:110 — crates/rig-postgres/src/memory.rs:110-120 | crates/rig-sqlite/src/memory.rs:88-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) crates/rig-agent/src/test_utils/model_conformance.rs:1921 — crates/rig-agent/src/test_utils/model_conformance.rs:1921-1931 | crates/rig-agent/src/test_utils/model_conformance.rs:2070-2080 — both copies are in the same file, so extract the block into 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/rig-core/src/test_utils/streaming.rs:356 — crates/rig-core/src/test_utils/streaming.rs:356-366 | crates/rig-core/src/test_utils/streaming.rs:368-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×4
  • Duplicated block (5 lines × 3) corpus/ct/src/conversation_chapters.rs:812 — corpus/ct/src/conversation_chapters.rs:812-816 | corpus/ho/src/auto_session_name.rs:140-144 | corpus/oc/src/away_recap.rs:331-335 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/conversation_chapters.rs:812` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 3) crates/rig-core/src/providers/cohere/chat.rs:240 — crates/rig-core/src/providers/cohere/chat.rs:240-245 | crates/rig-core/src/providers/ollama/chat.rs:334-338 | crates/rig-core/src/providers/openai/wire/chat.rs:601-605 — `crates/rig-core/src/providers/cohere/chat.rs` and `crates/rig-core/src/providers/ollama/chat.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/cohere/chat.rs:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 3) corpus/base/src/files_panel.rs:133 — corpus/base/src/files_panel.rs:133-137 | corpus/ho/src/hunk_review.rs:214-218 | corpus/ho/src/working_set_carryover.rs:317-321 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) crates/rig-core/src/providers/cohere/embeddings.rs:118 — crates/rig-core/src/providers/cohere/embeddings.rs:118-122 | crates/rig-core/src/providers/ollama/embedding.rs:91-95 | crates/rig-core/src/providers/voyageai/wire.rs:166-170 — 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.
AXS1 · Runtime exposed surface · Runtime opened a port the repository does not declare · ×3
  • Runtime opened a port the repository does not declare: wd-runtime-app 32768->4317/tcp on 0.0.0.0 — The booted stack published container port 4317/tcp of service 'wd-runtime-app' as host port 32768, but no ports:/expose:/EXPOSE entry in this repository names it — so it is most likely inherited from a base image. Observed after booting the stack in our sandbox, not read from a manifest. Advisory evidence for CRA Annex I (2)(j) (limit attack surfaces, including external interfaces); we do not assess whether the network it is published onto makes this a risk.
  • Runtime opened a port the repository does not declare: wd-runtime-app 32769->4318/tcp on 0.0.0.0 — The booted stack published container port 4318/tcp of service 'wd-runtime-app' as host port 32769, but no ports:/expose:/EXPOSE entry in this repository names it — so it is most likely inherited from a base image. Observed after booting the stack in our sandbox, not read from a manifest. Advisory evidence for CRA Annex I (2)(j) (limit attack surfaces, including external interfaces); we do not assess whether the network it is published onto makes this a risk.
  • Runtime opened a port the repository does not declare: wd-runtime-app 32770->55679/tcp on 0.0.0.0 — The booted stack published container port 55679/tcp of service 'wd-runtime-app' as host port 32770, but no ports:/expose:/EXPOSE entry in this repository names it — so it is most likely inherited from a base image. Observed after booting the stack in our sandbox, not read from a manifest. Advisory evidence for CRA Annex I (2)(j) (limit attack surfaces, including external interfaces); we do not assess whether the network it is published onto makes this a risk.
D1 · Cyclomatic Complexity · rig_agent · ×3
  • rig_agent::agent::engine::drive_agent (cyclomatic 39) crates/rig-agent/src/agent/engine.rs:152 — rig_agent::agent::engine::drive_agent 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.
  • rig_agent::agent::engine::drive_tool_calls (cyclomatic 30) crates/rig-agent/src/agent/engine.rs:512 — rig_agent::agent::engine::drive_tool_calls 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.
  • rig_agent::run::prepare::prepare_request (cyclomatic 22) crates/rig-agent/src/run/prepare.rs:126 — rig_agent::run::prepare::prepare_request 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 · Scrubber · ×3
  • Scrubber::scrub_json_in (cyclomatic 26) crates/rig-cassette/src/scrub.rs:1660 — Scrubber::scrub_json_in 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.
  • Scrubber::learn_json_in (cyclomatic 20) crates/rig-cassette/src/scrub.rs:1302 — Scrubber::learn_json_in 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.
  • Scrubber::learn_body_parts (cyclomatic 17) crates/rig-cassette/src/scrub.rs:864 — Scrubber::learn_body_parts 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 · rig_tools · ×3
  • rig_tools::watch::send_batches (cyclomatic 23) crates/rig-tools/src/watch.rs:690 — rig_tools::watch::send_batches 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.
  • rig_tools::process::forward_both (cyclomatic 18) crates/rig-tools/src/process.rs:356 — rig_tools::process::forward_both 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.
  • rig_tools::search::find (cyclomatic 17) crates/rig-tools/src/search.rs:322 — rig_tools::search::find has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Writer · ×3
  • Writer::start (cyclomatic 22) crates/rig-markdown/src/markdown.rs:315 — Writer::start 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.
  • Writer::end (cyclomatic 19) crates/rig-markdown/src/markdown.rs:397 — Writer::end 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.
  • Writer::encode (cyclomatic 16) crates/rig-cassette/src/effect_log/jsonl.rs:187 — Writer::encode 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 · corpus_ho · ×3
  • corpus_ho::hunk_review::revert (cyclomatic 18) corpus/ho/src/hunk_review.rs:378 — corpus_ho::hunk_review::revert 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.
  • corpus_ho::hunk_review::review (cyclomatic 18) corpus/ho/src/hunk_review.rs:454 — corpus_ho::hunk_review::review 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.
  • corpus_ho::session_recall::docs (cyclomatic 17) corpus/ho/src/session_recall.rs:475 — corpus_ho::session_recall::docs 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.
D2 · Cognitive Complexity · rig_agent · ×3
  • rig_agent::agent::engine::drive_agent (cognitive 80) crates/rig-agent/src/agent/engine.rs:152 — rig_agent::agent::engine::drive_agent has cognitive complexity 80 (threshold 15). Drivers by points: if/else 15 (37 pts), match/switch 13 (34 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_agent::agent::engine::drive_tool_calls (cognitive 50) crates/rig-agent/src/agent/engine.rs:512 — rig_agent::agent::engine::drive_tool_calls has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 5 (8 pts), match/switch 6 (8 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_agent::run::prepare::prepare_request (cognitive 19) crates/rig-agent/src/run/prepare.rs:126 — rig_agent::run::prepare::prepare_request has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, match/switch 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rig_markdown · ×3
  • rig_markdown::wrap::wrap_hanging (cognitive 31) crates/rig-markdown/src/wrap.rs:52 — rig_markdown::wrap::wrap_hanging has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • rig_markdown::markdown::table::grid (cognitive 26) crates/rig-markdown/src/markdown/table.rs:130 — rig_markdown::markdown::table::grid has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 4 (10 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.
  • rig_markdown::markdown::table::records (cognitive 17) crates/rig-markdown/src/markdown/table.rs:186 — rig_markdown::markdown::table::records has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (6 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Editor · ×3
  • Editor::run (cognitive 22) corpus/sn/src/vim_input/editor.rs:181 — Editor::run has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 5 (9 pts), loops 1 (2 pts) (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.
  • Editor::layout (cognitive 22) plugins/rig-tui/src/editor.rs:582 — Editor::layout has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Editor::operate (cognitive 16) corpus/sn/src/vim_input/editor.rs:255 — Editor::operate has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 2 (3 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · InteractionsDecoder · ×3
  • InteractionsDecoder::delta (cognitive 22) crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:282 — InteractionsDecoder::delta has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 4 (7 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.
  • InteractionsDecoder::decode (cognitive 20) crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:563 — InteractionsDecoder::decode has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 4 (7 pts), loops 1 (2 pts), boolean chains 1 (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.
  • InteractionsDecoder::stop (cognitive 19) crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:371 — InteractionsDecoder::stop has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Writer · ×3
  • Writer::encode (cognitive 20) crates/rig-cassette/src/effect_log/jsonl.rs:187 — Writer::encode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 5 (7 pts), loops 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::end (cognitive 18) crates/rig-markdown/src/markdown.rs:397 — Writer::end has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::start (cognitive 16) crates/rig-markdown/src/markdown.rs:315 — Writer::start has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 4 (7 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×3
  • Edited copy of a member (28 corresponding lines) corpus/base/src/skills.rs:259 — corpus/base/src/skills.rs:259-286 | corpus/sn/src/glob_rules.rs:342-372 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) crates/rig-core/src/providers/openai/options.rs:1167 — crates/rig-core/src/providers/openai/options.rs:1167-1194 | crates/rig-core/src/providers/openai/options.rs:1242-1269 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) corpus/base/src/skills.rs:32 — corpus/base/src/skills.rs:32-66 | corpus/sn/src/glob_rules.rs:54-81 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×3
  • Edited copy of a member (19 corresponding lines) corpus/fh/src/audit_log/chain.rs:140 — corpus/fh/src/audit_log/chain.rs:140-158 | xtask/src/catalog.rs:379-406 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) corpus/ho/src/socket_attach.rs:490 — corpus/ho/src/socket_attach.rs:490-508 | corpus/ho/src/socket_attach.rs:518-536 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) corpus/oc/src/architect_editor.rs:227 — corpus/oc/src/architect_editor.rs:227-248 | corpus/shared/src/plan_mode.rs:91-109 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×3
  • Edited copy of a member (21 corresponding lines) corpus/base/src/debate.rs:318 — corpus/base/src/debate.rs:318-338 | corpus/sn/src/task_queue.rs:467-493 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) corpus/base/src/agent_profiles.rs:403 — corpus/base/src/agent_profiles.rs:403-426 | corpus/base/src/pinned_notes.rs:195-215 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/rig-core/src/providers/chatgpt/auth/native.rs:503 — crates/rig-core/src/providers/chatgpt/auth/native.rs:503-523 | crates/rig-core/src/providers/chatgpt/auth/native.rs:534-558 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×3
  • Edited copy of a member (23 corresponding lines) crates/rig-tools/src/attach.rs:75 — crates/rig-tools/src/attach.rs:75-101 | crates/rig-tools/src/attach.rs:105-127 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) corpus/fh/src/standing_team.rs:311 — corpus/fh/src/standing_team.rs:311-336 | corpus/oc/src/architect_editor.rs:467-489 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) corpus/sn/src/stray_file_cleanup.rs:407 — corpus/sn/src/stray_file_cleanup.rs:407-429 | corpus/sn/src/terminal_sessions.rs:558-580 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×3
  • Edited copy of a member (15 corresponding lines) crates/rig-tools/src/remote.rs:441 — crates/rig-tools/src/remote.rs:441-455 | crates/rig-tools/src/remote.rs:628-655 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) corpus/base/src/http_api.rs:372 — corpus/base/src/http_api.rs:372-386 | corpus/ho/src/socket_attach.rs:472-487 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/rig-core/src/test_utils/streaming_conformance.rs:2075 — crates/rig-core/src/test_utils/streaming_conformance.rs:2075-2089 | crates/rig-core/src/test_utils/streaming_conformance.rs:2094-2108 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 7+ corresponding lines) corpus/base/src/shell_rewrite.rs:94 — corpus/base/src/shell_rewrite.rs:94-100 | corpus/fh/src/safety_judge.rs:125-131 | corpus/sn/src/tool_stats.rs:209-217 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/rig-core/src/providers/anthropic/modality.rs:144 — crates/rig-core/src/providers/anthropic/modality.rs:144-153 | crates/rig-core/src/providers/gemini/model_listing.rs:236-242 | crates/rig-core/src/providers/ollama/model_listing.rs:69-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) corpus/base/src/code_search_index.rs:1074 — corpus/base/src/code_search_index.rs:1074-1080 | corpus/ho/src/background_verify.rs:576-582 | corpus/sn/src/scope_fence.rs:269-275 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×3
  • Duplicated block (13 lines × 2) corpus/oc/src/dataset_cli.rs:202 — corpus/oc/src/dataset_cli.rs:202-214 | corpus/sn/src/usage_report_cli.rs:72-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) corpus/sn/src/terminal_sessions.rs:380 — corpus/sn/src/terminal_sessions.rs:380-392 | corpus/sn/src/terminal_sessions.rs:451-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/sn/src/terminal_sessions.rs:380` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) plugins/rig-acp/src/router.rs:645 — plugins/rig-acp/src/router.rs:645-657 | plugins/rig-acp/src/router.rs:659-671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/rig-acp/src/router.rs:645` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D1 · Cyclomatic Complexity · Markdown · ×2
  • Markdown::start (cyclomatic 30) corpus/sn/src/web_fetch/markdown.rs:153 — Markdown::start 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.
  • Markdown::end (cyclomatic 22) corpus/sn/src/web_fetch/markdown.rs:259 — Markdown::end 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 · rig_candle · ×2
  • rig_candle::protocol::render_qwen_message (cyclomatic 29) crates/rig-candle/src/protocol.rs:518 — rig_candle::protocol::render_qwen_message 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.
  • rig_candle::protocol::parse_qwen3_assistant (cyclomatic 19) crates/rig-candle/src/protocol.rs:690 — rig_candle::protocol::parse_qwen3_assistant 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 · rig_acp · ×2
  • rig_acp::translate::replay (cyclomatic 27) plugins/rig-acp/src/translate.rs:192 — rig_acp::translate::replay 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.
  • rig_acp::session::open (cyclomatic 16) plugins/rig-acp/src/session.rs:757 — rig_acp::session::open 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 · Chat · ×2
  • Chat::assistant (cyclomatic 25) crates/rig-core/src/providers/openai/wire/chat.rs:388 — Chat::assistant 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.
  • Chat::encodes (cyclomatic 17) crates/rig-core/src/providers/openai/wire/chat.rs:872 — Chat::encodes 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 · GenerateContentDecoder · ×2
  • GenerateContentDecoder::decode (cyclomatic 21) crates/rig-core/src/providers/gemini/streaming.rs:93 — GenerateContentDecoder::decode 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.
  • GenerateContentDecoder::part (cyclomatic 17) crates/rig-core/src/providers/gemini/streaming.rs:293 — GenerateContentDecoder::part 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 · InteractionsDecoder · ×2
  • InteractionsDecoder::delta (cyclomatic 20) crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:282 — InteractionsDecoder::delta 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.
  • InteractionsDecoder::decode (cyclomatic 20) crates/rig-core/src/providers/gemini/interactions_api/streaming.rs:563 — InteractionsDecoder::decode 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 · rig_bedrock · ×2
  • rig_bedrock::request::base (cyclomatic 19) crates/rig-bedrock/src/request.rs:62 — rig_bedrock::request::base has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • rig_bedrock::options::claude_reasoning (cyclomatic 17) crates/rig-bedrock/src/options.rs:27 — rig_bedrock::options::claude_reasoning 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 · corpus_base · ×2
  • corpus_base::debate::step (cyclomatic 18) corpus/base/src/debate.rs:359 — corpus_base::debate::step has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • corpus_base::export::render::walk (cyclomatic 17) corpus/base/src/export/render.rs:155 — corpus_base::export::render::walk 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 · rig_memory · ×2
  • rig_memory::rewrite::rewrite (cyclomatic 18) crates/rig-memory/src/rewrite.rs:628 — rig_memory::rewrite::rewrite 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.
  • rig_memory::rewrite::map_file (cyclomatic 16) crates/rig-memory/src/rewrite.rs:339 — rig_memory::rewrite::map_file 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 · Catalog · ×2
  • Catalog::from_overrides (cognitive 39) crates/rig-core/src/catalog/read.rs:157 — Catalog::from_overrides has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 3 (7 pts), loops 3 (5 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.
  • Catalog::from_models_dev (cognitive 18) crates/rig-core/src/catalog/read.rs:286 — Catalog::from_models_dev has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EffectLogReplayer · ×2
  • EffectLogReplayer::serve (cognitive 37) crates/rig-cassette/src/effect_log/replay.rs:641 — EffectLogReplayer::serve has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 3 (7 pts), loops 1 (4 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.
  • EffectLogReplayer::check_header (cognitive 16) crates/rig-cassette/src/effect_log/replay.rs:263 — EffectLogReplayer::check_header has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Chat · ×2
  • Chat::assistant (cognitive 37) crates/rig-core/src/providers/openai/wire/chat.rs:388 — Chat::assistant has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 4 (10 pts), loops 3 (6 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.
  • Chat::base (cognitive 28) crates/rig-core/src/providers/openai/wire/chat.rs:237 — Chat::base has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Message · ×2
  • Message::absorb (cognitive 28) crates/rig-core/src/providers/anthropic/streaming/document.rs:156 — Message::absorb has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (3 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.
  • Message::message_delta (cognitive 16) crates/rig-core/src/providers/anthropic/streaming/document.rs:120 — Message::message_delta has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Kept · ×2
  • Kept::line (cognitive 28) crates/rig-tools/src/shell.rs:624 — Kept::line has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 3 (5 pts), boolean chains 4, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Kept::text (cognitive 18) crates/rig-tools/src/shell.rs:767 — Kept::text has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), boolean chains 1, loops 1 (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 · GenerateContentDecoder · ×2
  • GenerateContentDecoder::part (cognitive 25) crates/rig-core/src/providers/gemini/streaming.rs:293 — GenerateContentDecoder::part has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GenerateContentDecoder::decode (cognitive 16) crates/rig-core/src/providers/gemini/streaming.rs:93 — GenerateContentDecoder::decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 5, boolean chains 2, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_mcp_client · ×2
  • rig_mcp_client::register (cognitive 25) plugins/rig-mcp-client/src/lib.rs:1056 — rig_mcp_client::register has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (24 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.
  • rig_mcp_client::unreached (cognitive 21) plugins/rig-mcp-client/src/lib.rs:886 — rig_mcp_client::unreached has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Runner · ×2
  • Runner::run (cognitive 22) plugins/rig-basics/src/helpers.rs:494 — Runner::run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (7 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Runner::steps (cognitive 16) corpus/fh/src/open_pr.rs:1189 — Runner::steps has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Repo · ×2
  • Repo::push (cognitive 21) corpus/ct/src/git_guardrails/rules.rs:384 — Repo::push has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Repo::commit (cognitive 20) corpus/ct/src/git_guardrails/rules.rs:498 — Repo::commit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 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 · Index · ×2
  • Index::update (cognitive 21) corpus/ho/src/session_recall.rs:268 — Index::update has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Index::search (cognitive 16) corpus/ho/src/session_recall.rs:333 — Index::search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Markdown · ×2
  • Markdown::start (cognitive 21) corpus/sn/src/web_fetch/markdown.rs:153 — Markdown::start has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Markdown::end (cognitive 18) corpus/sn/src/web_fetch/markdown.rs:259 — Markdown::end has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResponsesDecoder · ×2
  • ResponsesDecoder::done (cognitive 20) crates/rig-core/src/providers/openai/responses_api/streaming.rs:607 — ResponsesDecoder::done has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, 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.
  • ResponsesDecoder::finish (cognitive 16) crates/rig-core/src/providers/openai/responses_api/streaming.rs:791 — ResponsesDecoder::finish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_typesafeai · ×2
  • rig_typesafeai::questions::validate_definition (cognitive 19) crates/rig-typesafeai/src/questions.rs:565 — rig_typesafeai::questions::validate_definition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • rig_typesafeai::questions::validate (cognitive 17) crates/rig-typesafeai/src/questions.rs:651 — rig_typesafeai::questions::validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (4 members, 50+ identical tokens) corpus/ct/src/schema_adapter/schema.rs:376 — corpus/ct/src/schema_adapter/schema.rs:376-393 | corpus/ho/src/degenerate_stream_cutter.rs:425-442 | corpus/oc/src/dependency_guard.rs:70-88 | corpus/sn/src/web_fetch/policy.rs:119-139 — 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/rig-core/src/providers/minimax/extension.rs:158 — crates/rig-core/src/providers/minimax/extension.rs:158-178 | crates/rig-core/src/providers/moonshot/extension.rs:146-166 | crates/rig-core/src/providers/xiaomimimo/extension.rs:67-86 | crates/rig-core/src/providers/zai/extension.rs:170-189 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×2
  • Edited copy of a member (24 corresponding lines) crates/rig-core/src/completion/message.rs:1149 — crates/rig-core/src/completion/message.rs:1149-1172 | crates/rig-core/src/completion/message.rs:1175-1198 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) corpus/base/src/skills.rs:124 — corpus/base/src/skills.rs:124-147 | corpus/sn/src/glob_rules.rs:257-283 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×2
  • Edited copy of a member (25 corresponding lines) corpus/oc/src/dataset_cli.rs:201 — corpus/oc/src/dataset_cli.rs:201-225 | corpus/sn/src/usage_report_cli.rs:71-99 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) test-support/rig-test-support/src/cache_conformance.rs:378 — test-support/rig-test-support/src/cache_conformance.rs:378-402 | test-support/rig-test-support/src/cache_conformance.rs:429-468 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 30+ corresponding lines) crates/rig-core/src/providers/cohere/chat.rs:163 — crates/rig-core/src/providers/cohere/chat.rs:163-192 | crates/rig-core/src/providers/ollama/chat.rs:174-206 | crates/rig-core/src/providers/openai/wire/chat.rs:347-380 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 30+ corresponding lines) crates/rig-core/src/test_utils/streaming_conformance.rs:858 — crates/rig-core/src/test_utils/streaming_conformance.rs:858-891 | crates/rig-core/src/test_utils/streaming_conformance.rs:947-977 | crates/rig-core/src/test_utils/streaming_conformance.rs:1014-1043 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×2
  • Edited copy of a member (20 corresponding lines) corpus/base/src/map_reduce.rs:454 — corpus/base/src/map_reduce.rs:454-477 | corpus/ho/src/relay_pipeline.rs:477-496 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) corpus/base/src/git_status_item/item.rs:99 — corpus/base/src/git_status_item/item.rs:99-118 | corpus/ct/src/status_command.rs:52-74 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×2
  • Edited copy of a member (17 corresponding lines) corpus/ho/src/background_verify.rs:482 — corpus/ho/src/background_verify.rs:482-498 | corpus/oc/src/coverage_gap_nudge.rs:767-785 — 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) test-support/rig-test-support/src/comparison_guard.rs:70 — test-support/rig-test-support/src/comparison_guard.rs:70-87 | test-support/rig-test-support/src/comparison_guard.rs:91-107 — 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 · Edited copies of one member (3 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 9+ corresponding lines) corpus/library/src/session_doctor_library.rs:363 — corpus/library/src/session_doctor_library.rs:363-371 | corpus/library/src/session_edit_library.rs:661-669 | corpus/oc/src/session_bundle.rs:290-298 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) corpus/base/src/nested_context.rs:167 — corpus/base/src/nested_context.rs:167-176 | corpus/base/src/skills.rs:315-324 | corpus/ho/src/read_before_edit.rs:133-141 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 5+ corresponding lines) corpus/oc/src/message_ratings.rs:149 — corpus/oc/src/message_ratings.rs:149-153 | corpus/sn/src/bookmarks.rs:81-85 | plugins/rig-basics/src/welcome.rs:183-187 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) corpus/sn/src/server_side_state.rs:274 — corpus/sn/src/server_side_state.rs:274-278 | crates/rig-core/src/serve/layer.rs:120-124 | crates/rig-core/src/serve/map.rs:38-42 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×2
  • Duplicated block (16 lines × 2) corpus/ct/src/ask_session_cli.rs:258 — corpus/ct/src/ask_session_cli.rs:258-273 | corpus/sp/src/commit_msg_hook.rs:246-261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/ask_session_cli.rs:258` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) test-support/rig-test-support/src/cache_conformance.rs:585 — test-support/rig-test-support/src/cache_conformance.rs:585-600 | test-support/rig-test-support/src/cache_conformance.rs:629-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `test-support/rig-test-support/src/cache_conformance.rs:585` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×2
  • Duplicated block (14 lines × 2) corpus/sn/src/model_params.rs:460 — corpus/sn/src/model_params.rs:460-473 | xtask/src/catalog.rs:947-960 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) test-support/rig-test-support/src/raw_capture/chat.rs:68 — test-support/rig-test-support/src/raw_capture/chat.rs:68-81 | test-support/rig-test-support/src/raw_capture/chat.rs:154-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `test-support/rig-test-support/src/raw_capture/chat.rs:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×2
  • Duplicated block (10–11 lines × 2) crates/rig-core/src/providers/cohere/chat.rs:237 — crates/rig-core/src/providers/cohere/chat.rs:237-247 | crates/rig-core/src/providers/ollama/chat.rs:331-340 — `crates/rig-core/src/providers/cohere/chat.rs` and `crates/rig-core/src/providers/ollama/chat.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/cohere/chat.rs:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) xtask/src/verify/extras.rs:51 — xtask/src/verify/extras.rs:51-61 | xtask/src/verify/guards.rs:96-105 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/verify/extras.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 3) · ×2
  • Duplicated block (8 lines × 3) corpus/oc/src/dataset_cli.rs:218 — corpus/oc/src/dataset_cli.rs:218-225 | corpus/oc/src/line_provenance.rs:630-637 | corpus/sn/src/usage_report_cli.rs:92-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/oc/src/dataset_cli.rs:218` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) crates/rig-core/src/providers/anthropic/options.rs:320 — crates/rig-core/src/providers/anthropic/options.rs:320-327 | crates/rig-core/src/providers/openai/options.rs:1117-1124 | crates/rig-core/src/providers/openai/options.rs:1249-1256 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/anthropic/options.rs:320` it begins part-way through the construct above it, so those 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 × 3) · ×2
  • Duplicated block (7 lines × 3) corpus/base/src/skills.rs:260 — corpus/base/src/skills.rs:260-266 | corpus/ho/src/script_tools.rs:172-178 | corpus/sn/src/glob_rules.rs:343-349 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) crates/rig-qdrant/src/filter.rs:281 — crates/rig-qdrant/src/filter.rs:281-287 | crates/rig-qdrant/src/filter.rs:292-298 | crates/rig-qdrant/src/filter.rs:303-309 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-qdrant/src/filter.rs:281` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×2
  • Edited copy of a member (26 corresponding lines) crates/rig-core/src/test_utils/streaming_conformance.rs:983 — crates/rig-core/src/test_utils/streaming_conformance.rs:983-1009 | crates/rig-core/src/test_utils/streaming_conformance.rs:1080-1105 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) test-support/rig-test-support/src/cache_conformance.rs:574 — test-support/rig-test-support/src/cache_conformance.rs:574-600 | test-support/rig-test-support/src/cache_conformance.rs:621-646 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
AXR1 · Runtime accessibility (rendered) · WCAG 2.4.2 reproducibly failed in a rendered surface · ×1
  • WCAG 2.4.2 reproducibly failed in a rendered surface — axe-core rule(s) document-title failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
AXR1 · Runtime accessibility (rendered) · WCAG 3.1.1 reproducibly failed in a rendered surface · ×1
  • WCAG 3.1.1 reproducibly failed in a rendered surface — axe-core rule(s) html-has-lang failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
D1 · Cyclomatic Complexity · StreamingTurnSource · ×1
  • StreamingTurnSource::run_model_turn (cyclomatic 48) crates/rig-agent/src/agent/engine.rs:865 — StreamingTurnSource::run_model_turn 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 · rig_cli · ×1
  • rig_cli::run::run_agent (cyclomatic 41) crates/rig-cli/src/run.rs:281 — rig_cli::run::run_agent has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentRun · ×1
  • AgentRun::next_step (cyclomatic 29) crates/rig-agent/src/run/mod.rs:879 — AgentRun::next_step 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 · QdrantFilter · ×1
  • QdrantFilter::interpret (cyclomatic 29) crates/rig-qdrant/src/filter.rs:137 — QdrantFilter::interpret has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 3 function items inside it that branch (to_condition, to_filter, to_match). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · corpus_ct · ×1
  • corpus_ct::git_guardrails::shell::lex (cyclomatic 28) corpus/ct/src/git_guardrails/shell.rs:146 — corpus_ct::git_guardrails::shell::lex 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.
D1 · Cyclomatic Complexity · Screen · ×1
  • Screen::csi (cyclomatic 28) corpus/sn/src/terminal_sessions/screen.rs:215 — Screen::csi 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.
D1 · Cyclomatic Complexity · Stopper · ×1
  • Stopper::stop (cyclomatic 26) crates/rig-ecs/src/turn.rs:674 — Stopper::stop has cyclomatic complexity 26 (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 · corpus_library · ×1
  • corpus_library::transcript_import_library::import (cyclomatic 23) corpus/library/src/transcript_import_library.rs:229 — corpus_library::transcript_import_library::import 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 · ChatResponse · ×1
  • ChatResponse::absorb (cyclomatic 23) crates/rig-core/src/providers/cohere/streaming/document.rs:63 — ChatResponse::absorb 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 · Reply · ×1
  • Reply::observed (cyclomatic 22) crates/rig-core/src/serve/handler.rs:516 — Reply::observed 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 · Validator · ×1
  • Validator::check (cyclomatic 22) crates/rig-core/src/tool/validate.rs:104 — Validator::check 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 · Repo · ×1
  • Repo::push (cyclomatic 21) corpus/ct/src/git_guardrails/rules.rs:384 — Repo::push 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 · Message · ×1
  • Message::absorb (cyclomatic 21) crates/rig-core/src/providers/anthropic/streaming/document.rs:156 — Message::absorb 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 · rig_derive · ×1
  • rig_derive::tool::expand::expand_rig_tool (cyclomatic 21) crates/rig-derive/src/tool/expand.rs:108 — rig_derive::tool::expand::expand_rig_tool 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 · Kept · ×1
  • Kept::line (cyclomatic 21) crates/rig-tools/src/shell.rs:624 — Kept::line 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 · Job · ×1
  • Job::diagnostics (cyclomatic 20) corpus/fh/src/lsp_tools.rs:596 — Job::diagnostics 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 · Manifest · ×1
  • Manifest::entries (cyclomatic 20) corpus/oc/src/dependency_guard.rs:688 — Manifest::entries has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Editor · ×1
  • Editor::run (cyclomatic 20) corpus/sn/src/vim_input/editor.rs:181 — Editor::run has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CacheBook · ×1
  • CacheBook::plan (cyclomatic 20) crates/rig-core/src/providers/gemini/caching.rs:769 — CacheBook::plan 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 · Responses · ×1
  • Responses::base (cyclomatic 20) crates/rig-core/src/providers/openai/responses_api/mod.rs:469 — Responses::base 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 · OAuthTransport · ×1
  • OAuthTransport::prepare (cyclomatic 20) plugins/rig-claude-cloak/src/transport.rs:885 — OAuthTransport::prepare 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 · PrintPlugin · ×1
  • PrintPlugin::finish (cyclomatic 19) plugins/rig-basics/src/print.rs:146 — PrintPlugin::finish 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 · Rewinder · ×1
  • Rewinder::rewind (cyclomatic 18) corpus/base/src/checkpoint_rewind.rs:504 — Rewinder::rewind 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 · StreamState · ×1
  • StreamState::delta (cyclomatic 18) crates/rig-bedrock/src/streaming.rs:141 — StreamState::delta 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 · JsonObjectContext · ×1
  • JsonObjectContext::field (cyclomatic 18) crates/rig-cassette/src/scrub.rs:120 — JsonObjectContext::field 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 · Caching · ×1
  • Caching::send (cyclomatic 18) crates/rig-core/src/client/gemini_caching.rs:362 — Caching::send 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 · Summarizer · ×1
  • Summarizer::serialize (cyclomatic 18) crates/rig-memory/src/compaction.rs:1194 — Summarizer::serialize 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 · Catalog · ×1
  • Catalog::from_overrides (cyclomatic 17) crates/rig-core/src/catalog/read.rs:157 — Catalog::from_overrides 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 · Transcript · ×1
  • Transcript::update (cyclomatic 17) plugins/rig-tui/src/transcript.rs:996 — Transcript::update 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 · Session · ×1
  • Session::record_one (cyclomatic 17) xtask/src/cassette/record.rs:284 — Session::record_one 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 · corpus_sp · ×1
  • corpus_sp::dead_ends_ledger::review_shell (cyclomatic 16) corpus/sp/src/dead_ends_ledger.rs:367 — corpus_sp::dead_ends_ledger::review_shell 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 · ReplyFold · ×1
  • ReplyFold::settle (cyclomatic 16) crates/rig-core/src/operation/completion.rs:750 — ReplyFold::settle 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 · NativeChat · ×1
  • NativeChat::assistant (cyclomatic 16) crates/rig-core/src/providers/cohere/chat.rs:199 — NativeChat::assistant 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 · Serving · ×1
  • Serving::serve (cyclomatic 16) crates/rig-core/src/providers/internal/auth/loopback.rs:311 — Serving::serve 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 · ResponsesDecoder · ×1
  • ResponsesDecoder::done (cyclomatic 16) crates/rig-core/src/providers/openai/responses_api/streaming.rs:607 — ResponsesDecoder::done 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 · StreamRecord · ×1
  • StreamRecord::push (cyclomatic 16) crates/rig-core/src/streaming/event.rs:299 — StreamRecord::push 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 · Out · ×1
  • Out::fragment (cyclomatic 16) crates/rig-core/src/operation/completion.rs:1495 — Out::fragment 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 · rig_markdown · ×1
  • rig_markdown::wrap::wrap_hanging (cyclomatic 16) crates/rig-markdown/src/wrap.rs:52 — rig_markdown::wrap::wrap_hanging 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 · Options · ×1
  • Options::parse (cyclomatic 16) xtask/src/verify.rs:62 — Options::parse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment corpus/base/src/todo_tracker.rs:1 — //! Todo tracker. The `todo` tool keeps a todo list per agent ([`Todos`], saved with 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.
D2 · Cognitive Complexity · StreamingTurnSource · ×1
  • StreamingTurnSource::run_model_turn (cognitive 132) crates/rig-agent/src/agent/engine.rs:865 — StreamingTurnSource::run_model_turn has cognitive complexity 132 (threshold 15). Drivers by points: if/else 18 (67 pts), match/switch 15 (49 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 90). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentRun · ×1
  • AgentRun::next_step (cognitive 70) crates/rig-agent/src/run/mod.rs:879 — AgentRun::next_step has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (63 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 44). 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 · rig_acp · ×1
  • rig_acp::translate::replay (cognitive 58) plugins/rig-acp/src/translate.rs:192 — rig_acp::translate::replay has cognitive complexity 58 (threshold 15). Drivers by points: if/else 7 (25 pts), match/switch 5 (16 pts), loops 7 (15 pts), boolean chains 2 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Summarizer · ×1
  • Summarizer::serialize (cognitive 41) crates/rig-memory/src/compaction.rs:1194 — Summarizer::serialize has cognitive complexity 41 (threshold 15). Drivers by points: match/switch 7 (27 pts), loops 3 (7 pts), if/else 2 (6 pts), boolean chains 1 (nesting depth added 28). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · MacroArgs · ×1
  • MacroArgs::parse (cognitive 37) crates/rig-derive/src/tool/args.rs:99 — MacroArgs::parse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 4 (20 pts), loops 3 (9 pts), match/switch 3 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Job · ×1
  • Job::diagnostics (cognitive 36) corpus/fh/src/lsp_tools.rs:596 — Job::diagnostics has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (8 pts), match/switch 4 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manifest · ×1
  • Manifest::entries (cognitive 34) corpus/oc/src/dependency_guard.rs:688 — Manifest::entries has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 7 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Reply · ×1
  • Reply::observed (cognitive 32) crates/rig-core/src/serve/handler.rs:516 — Reply::observed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_derive · ×1
  • rig_derive::tool::expand::expand_rig_tool (cognitive 32) crates/rig-derive/src/tool/expand.rs:108 — rig_derive::tool::expand::expand_rig_tool has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 4 (5 pts), boolean chains 2, match/switch 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 · Graph · ×1
  • Graph::reads (cognitive 31) xtask/src/verify/graph.rs:285 — Graph::reads has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corpus_shared · ×1
  • corpus_shared::protected_paths::filter_searches (cognitive 30) corpus/shared/src/protected_paths.rs:348 — corpus_shared::protected_paths::filter_searches has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (8 pts), match/switch 3 (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 · SummaryState · ×1
  • SummaryState::track (cognitive 30) crates/rig-memory/src/compaction.rs:125 — SummaryState::track has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 4 (9 pts), match/switch 2 (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.
D2 · Cognitive Complexity · rig_bedrock · ×1
  • rig_bedrock::request::base (cognitive 28) crates/rig-bedrock/src/request.rs:62 — rig_bedrock::request::base has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (8 pts), match/switch 4 (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 · Stopper · ×1
  • Stopper::stop (cognitive 27) crates/rig-ecs/src/turn.rs:674 — Stopper::stop has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 5 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WireIds · ×1
  • WireIds::for_target (cognitive 25) crates/rig-core/src/providers/internal/wire_ids.rs:28 — WireIds::for_target has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 4 (11 pts), loops 4 (8 pts), if/else 2 (6 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 · PrintPlugin · ×1
  • PrintPlugin::finish (cognitive 25) plugins/rig-basics/src/print.rs:146 — PrintPlugin::finish has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OAuthTransport · ×1
  • OAuthTransport::prepare (cognitive 25) plugins/rig-claude-cloak/src/transport.rs:885 — OAuthTransport::prepare has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, loops 4 (5 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 · Rewinder · ×1
  • Rewinder::rewind (cognitive 24) corpus/base/src/checkpoint_rewind.rs:504 — Rewinder::rewind has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corpus_rf_07 · ×1
  • corpus_rf_07::checkpoints (cognitive 24) corpus/rf-07/src/lib.rs:378 — corpus_rf_07::checkpoints has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatResponse · ×1
  • ChatResponse::absorb (cognitive 24) crates/rig-core/src/providers/cohere/streaming/document.rs:63 — ChatResponse::absorb has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 2, boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Screen · ×1
  • Screen::csi (cognitive 23) corpus/sn/src/terminal_sessions/screen.rs:215 — Screen::csi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (10 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Responses · ×1
  • Responses::base (cognitive 23) crates/rig-core/src/providers/openai/responses_api/mod.rs:469 — Responses::base has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, match/switch 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 · Out · ×1
  • Out::fragment (cognitive 23) crates/rig-core/src/operation/completion.rs:1495 — Out::fragment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeChat · ×1
  • NativeChat::assistant (cognitive 22) crates/rig-core/src/providers/cohere/chat.rs:199 — NativeChat::assistant has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 4 (9 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerateContentResponse · ×1
  • GenerateContentResponse::candidate (cognitive 22) crates/rig-core/src/providers/gemini/streaming/document.rs:84 — GenerateContentResponse::candidate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (8 pts), loops 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Serving · ×1
  • Serving::serve (cognitive 22) crates/rig-core/src/providers/internal/auth/loopback.rs:311 — Serving::serve has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SseFramer · ×1
  • SseFramer::push_inner (cognitive 22) crates/rig-http/src/http_client/framing.rs:398 — SseFramer::push_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cron · ×1
  • Cron::after (cognitive 21) corpus/base/src/cron_agent/schedule.rs:106 — Cron::after has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Caching · ×1
  • Caching::send (cognitive 21) crates/rig-core/src/client/gemini_caching.rs:362 — Caching::send has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, match/switch 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, and 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 · CacheBook · ×1
  • CacheBook::plan (cognitive 21) crates/rig-core/src/providers/gemini/caching.rs:769 — CacheBook::plan has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · QdrantFilter · ×1
  • QdrantFilter::interpret::to_condition (cognitive 20) crates/rig-qdrant/src/filter.rs:165 — QdrantFilter::interpret::to_condition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Transcript · ×1
  • Transcript::update (cognitive 20) plugins/rig-tui/src/transcript.rs:996 — Transcript::update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry · ×1
  • Registry::render (cognitive 19) corpus/ct/src/metrics_endpoint/registry.rs:231 — Registry::render has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 3 (8 pts) (nesting depth added 11). 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 · Pty · ×1
  • Pty::wait (cognitive 19) corpus/sn/src/terminal_sessions/pty.rs:206 — Pty::wait has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parser · ×1
  • Parser::value (cognitive 19) corpus/sp/src/structured_config_edit/json.rs:102 — Parser::value has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 3 (6 pts), if/else 2 (4 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.
D2 · Cognitive Complexity · Validator · ×1
  • Validator::check (cognitive 19) crates/rig-core/src/tool/validate.rs:104 — Validator::check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rig_vertexai · ×1
  • rig_vertexai::types::completion_response::rest_chunk (cognitive 19) crates/rig-vertexai/src/types/completion_response.rs:15 — rig_vertexai::types::completion_response::rest_chunk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (8 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session · ×1
  • Session::record_one (cognitive 19) xtask/src/cassette/record.rs:284 — Session::record_one has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Report · ×1
  • Report::collect (cognitive 18) corpus/sn/src/usage_report_cli/report.rs:79 — Report::collect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (4 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 · MessagesDecoder · ×1
  • MessagesDecoder::delta (cognitive 18) crates/rig-core/src/providers/anthropic/streaming.rs:403 — MessagesDecoder::delta has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Resolve · ×1
  • Resolve::feature (cognitive 18) xtask/src/verify/graph.rs:502 — Resolve::feature has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Guard · ×1
  • Guard::visit_expr_call (cognitive 18) xtask/src/verify/guards.rs:530 — Guard::visit_expr_call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plan · ×1
  • Plan::of (cognitive 17) crates/rig-cassette/src/effect_log/jsonl.rs:821 — Plan::of has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StripXmlProcessor · ×1
  • StripXmlProcessor::process (cognitive 17) crates/rig-core/src/loaders/epub/text_processors.rs:42 — StripXmlProcessor::process has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReplyFold · ×1
  • ReplyFold::settle (cognitive 17) crates/rig-core/src/operation/completion.rs:750 — ReplyFold::settle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatDecoder · ×1
  • ChatDecoder::close_calls (cognitive 17) crates/rig-core/src/providers/openai/wire/chat.rs:1584 — ChatDecoder::close_calls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Layer · ×1
  • Layer::serve (cognitive 17) crates/rig-core/src/serve/layer.rs:138 — Layer::serve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StreamRecord · ×1
  • StreamRecord::push (cognitive 17) crates/rig-core/src/streaming/event.rs:299 — StreamRecord::push has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_harness_protocol · ×1
  • rig_harness_protocol::config::changes (cognitive 17) crates/rig-harness-protocol/src/config.rs:494 — rig_harness_protocol::config::changes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Secrets · ×1
  • Secrets::request_once (cognitive 17) plugins/rig-basics/src/redact.rs:280 — Secrets::request_once has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (5 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Template · ×1
  • Template::expand (cognitive 16) corpus/base/src/prompt_templates.rs:143 — Template::expand has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Rotating · ×1
  • Rotating::send_keyed (cognitive 16) corpus/ho/src/api_key_pool.rs:414 — Rotating::send_keyed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnaryTurnSource · ×1
  • UnaryTurnSource::run_model_turn (cognitive 16) crates/rig-agent/src/agent/engine.rs:1588 — UnaryTurnSource::run_model_turn has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (13 pts), boolean chains 1, if/else 1, loops 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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 · Known · ×1
  • Known::restore (cognitive 16) crates/rig-cassette/src/effect_log/jsonl.rs:710 — Known::restore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FileChange · ×1
  • FileChange::after_text (cognitive 16) crates/rig-core/src/tool/facts.rs:357 — FileChange::after_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClearToolOutputs · ×1
  • ClearToolOutputs::targets (cognitive 16) crates/rig-memory/src/compaction.rs:1409 — ClearToolOutputs::targets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rig_reqwest · ×1
  • rig_reqwest::follow_redirects (cognitive 16) crates/rig-reqwest/src/lib.rs:499 — rig_reqwest::follow_redirects has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LookLine · ×1
  • LookLine::colored (cognitive 16) plugins/rig-tui/src/renderers.rs:523 — LookLine::colored has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 4 (6 pts), match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Options · ×1
  • Options::parse (cognitive 16) xtask/src/verify.rs:62 — Options::parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · TooManyFields · ×1
  • TooManyFields: Quirks crates/rig-core/src/providers/openai/wire.rs:303 — TooManyFields — 46 stored fields beside 4 methods. The bar is 30 stored fields; this is 16 over it, 1.53× 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.
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: lib.rs → lib.rs, lib.rs, lib.rs crates/rig-mongodb/src/lib.rs — `crates/rig-mongodb/src/lib.rs` changes together with 3 other files — `crates/rig-postgres/src/lib.rs`, `crates/rig-scylladb/src/lib.rs`, `crates/rig-surrealdb/src/lib.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 · Edited copy of a member (41 corresponding lines) · ×1
  • Edited copy of a member (41 corresponding lines) crates/rig-cassette/src/http/snapshot.rs:466 — crates/rig-cassette/src/http/snapshot.rs:466-518 | xtask/src/cassette/acceptance.rs:307-347 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) crates/rig-core/src/providers/anthropic/options.rs:306 — crates/rig-core/src/providers/anthropic/options.rs:306-335 | crates/rig-core/src/providers/ollama/chat.rs:403-443 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) corpus/fh/src/editor_front.rs:776 — corpus/fh/src/editor_front.rs:776-804 | corpus/ho/src/hunk_review.rs:158-192 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 34+ corresponding lines) crates/rig-core/src/providers/openai/options.rs:715 — crates/rig-core/src/providers/openai/options.rs:715-750 | crates/rig-core/src/providers/openai/options.rs:917-950 | crates/rig-core/src/providers/openai/options.rs:1039-1076 | crates/rig-core/src/providers/openai/options.rs:1206-1240 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 25+ corresponding lines) crates/rig-core/src/providers/openai/options.rs:1078 — crates/rig-core/src/providers/openai/options.rs:1078-1106 | crates/rig-core/src/providers/openai/options.rs:1108-1132 | crates/rig-core/src/providers/openai/options.rs:1134-1165 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) corpus/base/src/check_after_turn.rs:267 — corpus/base/src/check_after_turn.rs:267-302 | corpus/ho/src/background_verify.rs:257-289 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 19+ corresponding lines) crates/rig-core/src/providers/openai/options.rs:695 — crates/rig-core/src/providers/openai/options.rs:695-713 | crates/rig-core/src/providers/openai/options.rs:752-782 | crates/rig-core/src/providers/openai/options.rs:810-835 | crates/rig-core/src/providers/openai/options.rs:952-984 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) crates/rig-milvus/src/lib.rs:174 — crates/rig-milvus/src/lib.rs:174-200 | crates/rig-milvus/src/lib.rs:207-241 — 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 (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) corpus/base/src/custom_provider.rs:185 — corpus/base/src/custom_provider.rs:185-206 | corpus/ho/src/command_provider.rs:199-220 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 16+ corresponding lines) corpus/base/src/auto_commit.rs:418 — corpus/base/src/auto_commit.rs:418-433 | corpus/base/src/notify.rs:262-277 | corpus/fh/src/editor_front.rs:1098-1114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) corpus/library/src/bin/session_compare.rs:5 — corpus/library/src/bin/session_compare.rs:5-17 | corpus/library/src/bin/session_doctor.rs:6-18 | corpus/library/src/bin/transcript_to_session.rs:9-21 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) crates/rig-vectorize/src/client/mod.rs:91 — crates/rig-vectorize/src/client/mod.rs:91-105 | crates/rig-vectorize/src/client/mod.rs:110-127 | crates/rig-vectorize/src/client/mod.rs:132-146 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) corpus/base/src/export/render.rs:413 — corpus/base/src/export/render.rs:413-420 | corpus/ho/src/inline_shell.rs:286-294 | corpus/library/src/session_edit_library.rs:803-811 | plugins/rig-acp/src/translate.rs:334-342 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/rig-core/src/providers/gemini/completion.rs:280 — crates/rig-core/src/providers/gemini/completion.rs:280-283 | crates/rig-gemini-grpc/src/completion.rs:109-112 | crates/rig-vertexai/src/completion.rs:178-181 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 1+ corresponding lines) crates/rig-core/src/providers/minimax.rs:87 — crates/rig-core/src/providers/minimax.rs:87-87 | crates/rig-core/src/providers/moonshot.rs:58-58 | crates/rig-core/src/providers/opencode.rs:54-54 | crates/rig-core/src/providers/xiaomimimo.rs:49-49 | crates/rig-core/src/providers/zai.rs:59-59 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) crates/rig-harness/src/host/launcher.rs:311 — crates/rig-harness/src/host/launcher.rs:311-316 | crates/rig-harness/src/host/signals.rs:172-177 | plugins/rig-basics/src/print.rs:1026-1031 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×1
  • Duplicated block (15 lines × 2) corpus/fh/src/editor_front.rs:785 — corpus/fh/src/editor_front.rs:785-799 | corpus/ho/src/hunk_review.rs:172-186 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/fh/src/editor_front.rs:785` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) crates/rig-core/src/providers/anthropic/streaming.rs:363 — crates/rig-core/src/providers/anthropic/streaming.rs:363-375 | crates/rig-core/src/providers/cohere/streaming.rs:218-231 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/anthropic/streaming.rs:363` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) crates/rig-candle/src/model.rs:705 — crates/rig-candle/src/model.rs:705-716 | crates/rig-candle/src/pose.rs:705-715 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `crates/rig-candle/src/model.rs:705` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×1
  • Duplicated block (9–10 lines × 2) crates/rig-core/src/providers/anthropic/streaming.rs:454 — crates/rig-core/src/providers/anthropic/streaming.rs:454-462 | crates/rig-core/src/providers/cohere/streaming.rs:280-289 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/anthropic/streaming.rs:454` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) corpus/sn/src/terminal_sessions.rs:378 — corpus/sn/src/terminal_sessions.rs:378-387 | corpus/sn/src/terminal_sessions.rs:449-458 | corpus/sn/src/terminal_sessions.rs:481-490 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) crates/rig-memory/src/tokens.rs:119 — crates/rig-memory/src/tokens.rs:119-127 | plugins/rig-tui/src/pick.rs:877-884 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) corpus/ct/src/schema_adapter/schema.rs:379 — corpus/ct/src/schema_adapter/schema.rs:379-386 | corpus/ho/src/degenerate_stream_cutter.rs:428-435 | corpus/oc/src/dependency_guard.rs:74-81 | corpus/sn/src/web_fetch/policy.rs:125-132 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/schema_adapter/schema.rs:379` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×1
  • Duplicated block (9 lines × 3) corpus/base/src/custom_provider.rs:174 — corpus/base/src/custom_provider.rs:174-182 | corpus/ho/src/command_provider.rs:188-196 | corpus/sn/src/race_models.rs:59-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) corpus/base/src/summarize_tool_output.rs:253 — corpus/base/src/summarize_tool_output.rs:253-258 | corpus/fh/src/mentions_and_images.rs:619-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. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/base/src/summarize_tool_output.rs:253` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×1
  • Duplicated block (6 lines × 3) corpus/ct/src/ask_session_cli/session.rs:211 — corpus/ct/src/ask_session_cli/session.rs:211-216 | crates/rig-core/src/completion/history.rs:1753-1758 | crates/rig-memory/src/compaction.rs:1207-1212 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/ask_session_cli/session.rs:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) crates/rig-core/src/providers/openai/options.rs:704 — crates/rig-core/src/providers/openai/options.rs:704-708 | crates/rig-core/src/providers/openai/options.rs:773-777 | crates/rig-core/src/providers/openai/options.rs:826-830 | crates/rig-core/src/providers/openai/options.rs:975-979 | crates/rig-core/src/providers/openai/options.rs:1097-1101 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:704` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) crates/rig-core/src/providers/openai/options.rs:945 — crates/rig-core/src/providers/openai/options.rs:945-950 | crates/rig-core/src/providers/openai/options.rs:1101-1106 | crates/rig-core/src/providers/openai/options.rs:1127-1132 | crates/rig-core/src/providers/openai/options.rs:1160-1165 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:945` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–5 lines × 3) · ×1
  • Duplicated block (2–5 lines × 3) crates/rig-core/src/providers/openai/options.rs:709 — crates/rig-core/src/providers/openai/options.rs:709-713 | crates/rig-core/src/providers/openai/options.rs:831-835 | crates/rig-core/src/providers/openai/options.rs:980-981 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:709` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) crates/rig-agent/src/run/transcript.rs:41 — crates/rig-agent/src/run/transcript.rs:41-49 | test-support/rig-test-support/src/history_survival/adversarial.rs:57-65 | test-support/rig-test-support/src/model_session.rs:1058-1066 | test-support/rig-test-support/src/support.rs:930-938 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) crates/rig-core/src/audio_generation.rs:50 — crates/rig-core/src/audio_generation.rs:50-60 | crates/rig-core/src/embeddings/embedding.rs:76-86 | crates/rig-core/src/image_generation.rs:54-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) crates/rig-core/src/providers/minimax/extension.rs:160 — crates/rig-core/src/providers/minimax/extension.rs:160-172 | crates/rig-core/src/providers/moonshot/extension.rs:148-160 | crates/rig-core/src/providers/xiaomimimo/extension.rs:69-81 | crates/rig-core/src/providers/zai/extension.rs:172-184 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/minimax/extension.rs:160` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/rig-core/src/providers/minimax/extension.rs:175` calls `reply_field` and `crates/rig-core/src/providers/xiaomimimo/extension.rs:84` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) corpus/base/src/http_api/server.rs:112 — corpus/base/src/http_api/server.rs:112-123 | corpus/ct/src/metrics_endpoint/server.rs:55-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) crates/rig-core/src/providers/openai/options.rs:772 — crates/rig-core/src/providers/openai/options.rs:772-777 | crates/rig-core/src/providers/openai/options.rs:825-830 | crates/rig-core/src/providers/openai/options.rs:902-907 | crates/rig-core/src/providers/openai/options.rs:974-979 | crates/rig-core/src/providers/openai/options.rs:1096-1101 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/providers/openai/options.rs:772` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) corpus/ct/src/conversation_chapters.rs:812 — corpus/ct/src/conversation_chapters.rs:812-816 | corpus/ho/src/auto_session_name.rs:140-144 | corpus/oc/src/away_recap.rs:331-335 | corpus/sp/src/changelog_fragments.rs:348-352 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `corpus/ct/src/conversation_chapters.rs:812` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) test-support/rig-test-support/src/raw_capture/chat.rs:56 — test-support/rig-test-support/src/raw_capture/chat.rs:56-89 | test-support/rig-test-support/src/raw_capture/responses.rs:91-128 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) crates/rig-agent/src/test_utils/model_conformance.rs:1751 — crates/rig-agent/src/test_utils/model_conformance.rs:1751-1778 | crates/rig-agent/src/test_utils/model_conformance.rs:1789-1820 | crates/rig-agent/src/test_utils/model_conformance.rs:1920-1946 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) crates/rig-agent/src/test_utils/model_conformance.rs:77 — crates/rig-agent/src/test_utils/model_conformance.rs:77-114 | crates/rig-agent/src/test_utils/model_conformance.rs:122-153 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 9+ corresponding lines) test-support/rig-test-support/src/goldens.rs:905 — test-support/rig-test-support/src/goldens.rs:905-913 | test-support/rig-test-support/src/goldens.rs:1595-1603 | test-support/rig-test-support/src/goldens.rs:1647-1655 | test-support/rig-test-support/src/goldens.rs:2082-2090 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) test-support/rig-test-support/src/reasoning.rs:331 — test-support/rig-test-support/src/reasoning.rs:331-346 | test-support/rig-test-support/src/reasoning.rs:404-421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `test-support/rig-test-support/src/reasoning.rs:404` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×1
  • Duplicated block (8–12 lines × 2) test-support/rig-test-support/src/raw_capture/chat.rs:57 — test-support/rig-test-support/src/raw_capture/chat.rs:57-64 | test-support/rig-test-support/src/raw_capture/chat.rs:144-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. Read the line range as the matched WINDOW rather than a finished unit: at `test-support/rig-test-support/src/raw_capture/chat.rs:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) crates/rig-core/src/test_utils/streaming_conformance.rs:862 — crates/rig-core/src/test_utils/streaming_conformance.rs:862-869 | crates/rig-core/src/test_utils/streaming_conformance.rs:901-911 | crates/rig-core/src/test_utils/streaming_conformance.rs:955-963 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rig-core/src/test_utils/streaming_conformance.rs:862` it begins part-way through the construct above it, so those 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.
D44 · Platform End-of-Life · End-of-life runtime · ×1
  • End-of-life runtime: Rust 1.97 rust-toolchain.toml:1 — rust-toolchain.toml declares Rust 1.97 as this project's toolchain file, and Rust 1.97, superseded by 1.98 on 2026-08-20 (the Rust project patches only the current stable). An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-08-20 is present and unfixable without moving off it. This is a migration rather than an upgrade: there is no newer release of a runtime that has ended.
Minor — 95 finding(s)
X4 · Structured logging · Interpolated log message defeats structured logging · ×35
  • Interpolated log message defeats structured logging crates/rig-vertexai/src/completion.rs:266 — `debug!` at line 266 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-vectorize/src/lib.rs:174 — `debug!` at line 174 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-vectorize/src/client/mod.rs:26 — `debug!` at line 26 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-vectorize/src/client/mod.rs:113 — `debug!` at line 113 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:583 — `info!` at line 583 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:637 — `debug!` at line 637 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:687 — `debug!` at line 687 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2028 — `debug!` at line 2028 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2063 — `debug!` at line 2063 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2075 — `debug!` at line 2075 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2081 — `debug!` at line 2081 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2089 — `debug!` at line 2089 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-sqlite/src/lib.rs:2106 — `debug!` at line 2106 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-rmcp/src/handler.rs:258 — `error!` at line 258 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-reqwest/src/lib.rs:163 — `warn!` at line 163 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/lib.rs:259 — `info!` at line 259 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/lib.rs:333 — `warn!` at line 333 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/lib.rs:390 — `info!` at line 390 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/lib.rs:428 — `warn!` at line 428 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/lib.rs:434 — `info!` at line 434 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-neo4j/src/vector_index.rs:171 — `debug!` at line 171 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-mongodb/src/lib.rs:237 — `info!` at line 237 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-core/src/vector_store/in_memory_store.rs:207 — `info!` at line 207 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-core/src/providers/openai/wire/chat.rs:270 — `warn!` at line 270 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/rig-core/src/providers/internal/mod.rs:111 — `trace!` at line 111 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `trace!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • + 10 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on Err · ×22
  • Silent fallback default on Err corpus/base/src/nested_context.rs:121 — `nested_files` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err corpus/ct/src/process_reaper/procfs.rs:92 — `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 corpus/ct/src/reply_review_comments.rs:240 — `removed_replies` 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 corpus/fh/src/encrypted_sessions.rs:66 — `read` turns every `Err` into `Ok(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 corpus/fh/src/encrypted_sessions/reseal.rs:152 — `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 corpus/fh/src/import_sessions.rs:322 — `session_files` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err corpus/oc/src/git_delta_context.rs:393 — `changes` 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 corpus/sn/src/terminal_sessions/screen.rs:222 — `csi` 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 corpus/sn/src/sessions_prune_cli.rs:613 — `bytes_under` 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 corpus/sn/src/terminal_sessions/pty.rs:329 — `in_session` 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/rig-cassette/src/http/ledger.rs:481 — `outstanding` 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/rig-cli/src/run.rs:222 — `legacy_warnings` 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/rig-core/src/tool/output.rs:145 — `render` turns every `Err` into `"<structured tool output>".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/rig-tools/src/fs.rs:428 — `read` turns every `Err` into `Some(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/rig-tools/src/watch.rs:290 — `update` 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 plugins/rig-acp/src/session/options.rs:39 — `of` 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 plugins/rig-acp/src/router.rs:716 — `serve` turns every `Err` into `Ok(acp::CloseSessionResponse::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 plugins/rig-basics/src/subagents/lifecycle.rs:117 — `open` 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 plugins/rig-basics/src/subagents/lifecycle.rs:129 — `askers` 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 plugins/rig-steel/src/program.rs:427 — `text` 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 plugins/rig-tui/src/theme.rs:241 — `of_terminal` 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 xtask/src/verify/preflight.rs:57 — `run` 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.
X10 · Duplicated predicate · Duplicated predicate · ×21
  • Duplicated predicate crates/rig-cli/src/run/tests.rs:283 — `!state.trim().is_empty() && !state.trim_start().starts_with('Z')` appears character-identically in 2 files — crates/rig-cli/src/run/tests.rs, crates/rig-harness-protocol/src/tests.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 corpus/sn/src/notebook_cells/notebook.rs:150 — `!text.is_empty() && !text.ends_with('\n')` appears character-identically in 3 files — corpus/sn/src/notebook_cells/notebook.rs, corpus/sn/src/stray_file_cleanup.rs, crates/rig-harness/src/progress.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 corpus/base/src/todo_tracker/tests.rs:49 — `!world.resource::<Ended>().0.is_empty() && world.get::<ActiveTurn>(agent).is_none()` appears character-identically in 2 files — corpus/base/src/todo_tracker/tests.rs, corpus/rf-03/src/todo/tests.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/rig-harness-protocol/src/tests.rs:506 — `alive() && std::time::Instant::now() < deadline` appears character-identically in 2 files — crates/rig-harness-protocol/src/tests.rs, crates/rig-harness/src/host/exit/tests.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/rig-harness/src/per_call/tests.rs:80 — `app.world().get::<Outcome>(call).is_none() && started.elapsed() < Duration::from_secs(5)` appears character-identically in 2 files — crates/rig-harness/src/per_call/tests.rs, plugins/rig-basics/src/preview/tests.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 corpus/fh/src/mentions_and_images.rs:421 — `before.is_empty() || before.ends_with(char::is_whitespace)` appears character-identically in 2 files — corpus/fh/src/mentions_and_images.rs, plugins/rig-tui/src/clipboard.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/rig-core/src/providers/internal/wire_ids.rs:102 — `c.is_ascii_alphanumeric() || c == '_' || c == '-'` appears character-identically in 2 files — crates/rig-core/src/providers/internal/wire_ids.rs, plugins/rig-mcp-client/src/config.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 corpus/base/src/output_truncate.rs:240 — `i > 0 && (digits.len() - i).is_multiple_of(3)` appears character-identically in 2 files — corpus/base/src/output_truncate.rs, corpus/base/src/summarize_tool_output.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 corpus/base/src/custom_provider/tests.rs:43 — `line.split_once(':') && name.eq_ignore_ascii_case("content-length")` appears character-identically in 4 files — corpus/base/src/custom_provider/tests.rs, corpus/base/src/local_models/tests.rs, corpus/oc/src/opaque_reasoning/tests.rs, corpus/oc/src/rate_limit_status/tests.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 corpus/base/src/check_after_turn.rs:380 — `message.author.kind != AuthorKind::User || message.command().is_some()` appears character-identically in 3 files — corpus/base/src/check_after_turn.rs, corpus/base/src/review_agent.rs, corpus/sn/src/stray_file_cleanup.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 corpus/ct/src/resume_subagent.rs:356 — `message.author.kind == AuthorKind::User && message.command().is_none()` appears character-identically in 3 files — corpus/ct/src/resume_subagent.rs, corpus/oc/src/away_recap.rs, corpus/oc/src/steer_and_queue.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 corpus/fh/src/lsp_tools/tests.rs:270 — `model.request_count() == 4 && !world.entity(agent).contains::<ActiveTurn>()` appears character-identically in 3 files — corpus/fh/src/lsp_tools/tests.rs, corpus/shared/src/plan_mode/tests.rs, plugins/rig-mcp-client/src/tests.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 corpus/base/src/prompt_templates.rs:270 — `name.is_empty() || name.contains(char::is_whitespace)` appears character-identically in 4 files — corpus/base/src/prompt_templates.rs, corpus/base/src/skills.rs, plugins/rig-basics/src/skills.rs, plugins/rig-mcp-client/src/approval.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/rig-cli/src/plugin/tests.rs:270 — `order.iter().all(Option::is_some) && order.is_sorted()` appears character-identically in 3 files — crates/rig-cli/src/plugin/tests.rs, crates/rig-ecs/src/restore/tests.rs, plugins/rig-basics/src/print/tests.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/rig-tools/src/workspace/tests.rs:268 — `output.status.success() && stdout.contains("1 passed")` appears character-identically in 2 files — crates/rig-tools/src/workspace/tests.rs, plugins/rig-claude-cloak/src/auth/tests.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/rig-bedrock/src/request.rs:250 — `reasoning.redacted || reasoning.text.trim().is_empty()` appears character-identically in 5 files — crates/rig-bedrock/src/request.rs, crates/rig-core/src/completion/history.rs, crates/rig-core/src/providers/anthropic/completion.rs, crates/rig-core/src/providers/gemini/completion.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 xtask/src/verify/guards.rs:128 — `relative.ends_with("REDACTED") || relative.contains("/tests/")` appears character-identically in 2 files — xtask/src/verify/guards.rs, xtask/src/wires.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 corpus/base/src/handoff.rs:135 — `rest.is_empty() || rest.starts_with(char::is_whitespace)` appears character-identically in 2 files — corpus/base/src/handoff.rs, corpus/fh/src/side_question.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/rig-core/src/providers/anthropic/streaming.rs:687 — `self.message_started && event.fields.get("message").is_some_and(Value::is_object)` appears character-identically in 2 files — crates/rig-core/src/providers/anthropic/streaming.rs, crates/rig-core/src/providers/anthropic/streaming/document.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 corpus/fh/src/mentions_and_images.rs:459 — `typed.author.kind != AuthorKind::User || typed.command().is_some()` appears character-identically in 2 files — corpus/fh/src/mentions_and_images.rs, corpus/oc/src/issue_references.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 corpus/base/src/prompt_templates.rs:339 — `watches.contains(change.watch) && change.event.names_files()` appears character-identically in 2 files — corpus/base/src/prompt_templates.rs, corpus/sp/src/output_styles.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.
P10 · Library API & versioning · Implementation type on the public API · ×5
  • Implementation type on the public API crates/rig-agent/src/integrations/cli_chatbot.rs:52 — 2 public types in `rig_agent.integrations.cli_chatbot` are marked as implementation by their own namespace, folder or name: `ChatImpl` (crates/rig-agent/src/integrations/cli_chatbot.rs:52, name ends in `Impl`), `AgentImpl` (crates/rig-agent/src/integrations/cli_chatbot.rs:57, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
  • Implementation type on the public API crates/rig-core/src/providers/internal/auth.rs:17 — 4 public types in `rig_core.providers.internal.auth` are marked as implementation by their own namespace, folder or name: `DeviceCodePrompt` (crates/rig-core/src/providers/internal/auth.rs:17, `internal`), `DeviceCodeHandler` (crates/rig-core/src/providers/internal/auth.rs:33, `internal`), `AuthError` (crates/rig-core/src/providers/internal/auth.rs:68, `internal`), `AuthContext` (crates/rig-core/src/providers/internal/auth.rs:98, `internal`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
  • Implementation type on the public API crates/rig-core/src/providers/internal/auth/loopback.rs:41 — 5 public types in `rig_core.providers.internal.auth.loopback` are marked as implementation by their own namespace, folder or name: `LoopbackHost` (crates/rig-core/src/providers/internal/auth/loopback.rs:41, `internal`), `LoopbackError` (crates/rig-core/src/providers/internal/auth/loopback.rs:51, `internal`), `Loopback` (crates/rig-core/src/providers/internal/auth/loopback.rs:74, `internal`), `Listener` (crates/rig-core/src/providers/internal/auth/loopback.rs:200, `internal`), `Received` (crates/rig-core/src/providers/internal/auth/loopback.rs:228, `internal`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
  • Implementation type on the public API crates/rig-core/src/providers/internal/mod.rs:97 — 1 public type in `rig_core.providers.internal` is marked as implementation by its own namespace, folder or name: `LogTarget` (crates/rig-core/src/providers/internal/mod.rs:97, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/rig-core/src/providers/internal/wire_ids.rs:16 — 1 public type in `rig_core.providers.internal.wire_ids` is marked as implementation by its own namespace, folder or name: `WireIds` (crates/rig-core/src/providers/internal/wire_ids.rs:16, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
D13 · Secret Scanning · REDACTED · ×1
  • REDACTED
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 672 significant file(s) lose their only recent owner: crates/rig-agent/src/agent/engine/tests.rs, plugins/rig-basics/src/compaction/tests.rs, crates/rig-agent/src/agent/streaming/tests.rs, crates/rig-cassette/src/http/mod.rs, plugins/rig-basics/src/print/tests.rs, crates/rig-core/src/providers/anthropic/completion/tests.rs, crates/rig-sqlite/src/tests.rs, crates/rig-agent/src/run/tests.rs (+664 more). Pair on, review, or document these before any departure.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found crates/rig-cli/Cargo.toml:16 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `crates/rig-cli/Cargo.toml` makes this repository a deployable product (line 16).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 11 of 61 project(s) overshoot their size bounds, lowering Project Cohesion to 6.4/10. The most over is `crates/rig-core` (128127 LoC, 1004 module-visible types across 63 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.
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 1 of 1383 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1383 of the 1592 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: crates/rig-vectorize/src/client/types.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D34 · Knowledge Freshness · Orphaned file · ×1
  • Orphaned file crates/rig-vectorize/src/client/types.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 23/34 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `corpus/ct`, `corpus/library`, `corpus/rf-01`, `corpus/rf-06`, `corpus/rf-07` and 6 more.
P3 · Security & performance tooling · Dependabot does not watch github-actions · ×1
  • Dependabot does not watch github-actions REDACTED:2 — `REDACTED` schedules updates, but no `package-ecosystem` entry covers `github-actions`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
S1 · Web-Security Posture · No app-layer HTTPS enforcement detected · ×1
  • No app-layer HTTPS enforcement detected — This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (crates/rig-cassette/src/http/mod.rs:1252).
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (crates/rig-cassette/src/http/mod.rs:1252).
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure plugins/rig-claude-cloak/tests/acceptance/audit.py:342 — `read_matches` returns `False` when `(ValueError, OSError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Minor — 41 finding(s)
D12 · Dependency Hygiene · Outdated · ×41
  • Outdated: aws-config — `aws-config` is locked at 1.12.0 but 1.13.2 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-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-sdk-bedrockruntime — `aws-sdk-bedrockruntime` is locked at 1.148.0 but 1.155.0 is the current stable release on crates.io, and it already satisfies the `"1.124"` requirement declared in crates/rig-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-s3vectors — `aws-sdk-s3vectors` is locked at 1.42.0 but 1.49.0 is the current stable release on crates.io, and it already satisfies the `"1.1.0"` requirement declared in crates/rig-s3vectors/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-s3vectors` and commit the updated REDACTED.
  • Outdated: aws-smithy-eventstream — `aws-smithy-eventstream` is locked at 0.61.4 but 0.61.6 is the current stable release on crates.io, and it already satisfies the `"0.61"` requirement declared in crates/rig-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-eventstream` and commit the updated REDACTED.
  • Outdated: aws-smithy-runtime-api — `aws-smithy-runtime-api` is locked at 1.19.0 but 1.21.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-runtime-api` and commit the updated REDACTED.
  • Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.8.1 but 1.9.4 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-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: crossbeam-channel — `crossbeam-channel` is locked at 0.5.15 but 0.5.17 is the current stable release on crates.io, and it already satisfies the `"0.5.15"` requirement declared in crates/rig-harness/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-channel` and commit the updated REDACTED.
  • Outdated: fastrand — `fastrand` is locked at 2.4.1 but 2.5.0 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in corpus/sn/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p fastrand` and commit the updated REDACTED.
  • Outdated: google-cloud-aiplatform-v1 — `google-cloud-aiplatform-v1` is locked at 1.11.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.8"` requirement declared in crates/rig-vertexai/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p google-cloud-aiplatform-v1` and commit the updated REDACTED.
  • Outdated: google-cloud-auth — `google-cloud-auth` is locked at 1.13.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-vertexai/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p google-cloud-auth` and commit the updated REDACTED.
  • Outdated: google-cloud-gax — `google-cloud-gax` is locked at 1.11.0 but 1.15.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-vertexai/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p google-cloud-gax` and commit the updated REDACTED.
  • Outdated: http — `http` is locked at 1.4.2 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in corpus/base/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http` and commit the updated REDACTED.
  • Outdated: http-body — `http-body` is locked at 1.0.1 but 1.1.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/rig-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http-body` and commit the updated REDACTED.
  • Outdated: ignore — `ignore` is locked at 0.4.25 but 0.4.34 is the current stable release on crates.io, and it already satisfies the `"0.4.25"` requirement declared in corpus/sn/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ignore` and commit the updated REDACTED.
  • Outdated: indexmap — `indexmap` is locked at 2.14.0 but 2.14.2 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in crates/rig-agent/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indexmap` and commit the updated REDACTED.
  • Outdated: libc — `libc` is locked at 0.2.186 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2.186"` requirement declared in corpus/base/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
  • Outdated: mime — `mime` is locked at 0.3.17 but 0.3.18 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in crates/rig-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p mime` and commit the updated REDACTED.
  • Outdated: mongodb — `mongodb` is locked at 3.9.1 but 3.10.1 is the current stable release on crates.io, and it already satisfies the `"3.4.1"` requirement declared in crates/rig-mongodb/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p mongodb` and commit the updated REDACTED.
  • Outdated: notify — `notify` is locked at 8.2.0 but 8.2.2 is the current stable release on crates.io, and it already satisfies the `"8"` requirement declared in crates/rig-tools/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p notify` and commit the updated REDACTED.
  • Outdated: ordered-float — `ordered-float` is locked at 5.3.0 but 5.5.1 is the current stable release on crates.io, and it already satisfies the `"5"` requirement declared in crates/rig-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ordered-float` and commit the updated REDACTED.
  • Outdated: proc-macro2 — `proc-macro2` is locked at 1.0.106 but 1.0.107 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proc-macro2` and commit the updated REDACTED.
  • Outdated: prost — `prost` is locked at 0.14.4 but 0.14.6 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in crates/rig-gemini-grpc/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p prost` and commit the updated REDACTED.
  • Outdated: prost-types — `prost-types` is locked at 0.14.4 but 0.14.6 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in crates/rig-gemini-grpc/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p prost-types` and commit the updated REDACTED.
  • Outdated: pulldown-cmark — `pulldown-cmark` is locked at 0.13.3 but 0.13.6 is the current stable release on crates.io, and it already satisfies the `"0.13"` requirement declared in crates/rig-markdown/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pulldown-cmark` and commit the updated REDACTED.
  • Outdated: redis — `redis` is locked at 1.6.0 but 1.8.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in examples/custom_vector_store/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p redis` and commit the updated REDACTED.
  • + 16 more in this group — see findings.md.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1527b7b5cab3401197bb0e4270b1fc0d/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1527b7b5cab3401197bb0e4270b1fc0d/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .24artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .46artifacts/raw/osv-scanner.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—
D36 · Supply-chain Provenance & Signingprovenance—provenance: not applicable — The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files).0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1daff-e3bc-7077-be7a-469398506263 · 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