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

HKUDS/Vibe-Trading

Measured 3 November 2026, 23:51 UTC, at code version 2ac2087

CAI score 52out of 100 Weak
CriticalWeakAdequateStrongExemplary
Up 7 since the last survey

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

A large codebase: 278,496 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 3.3 person-years · Weakest lens: Production Readiness, 42

Findings by how serious they are

17 critical 1994 serious 130 minor

11 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
3 November 2026, 23:51 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 ▸

90of 90 dimensions measured by tools.
2112of 2141 findings point to an exact file and line, so you can open each one in the code. The other 29 concern the repository as a whole, such as missing documentation.
90dimensions across 7 lenses, read from 278,496 lines of product code in 5 projects.
Chapters

Executive summary

HKUDS/Vibe-Trading falls short of our standard for a preview release because its Dependencies dimensions are rated Critical. It scores 52 out of 100, which alone would earn Adequate, but it is rated Weak: a rating can't sit more than one step above its weakest group.

Production Readiness, at 42, is the weakest lens and counts most in the score. The best first step is fixing the password or key in the code, worth about 8 points. Fixing the package under a licence on your banned list comes next, worth about 5 points. Raising Production Readiness to 62 would lift the score to about 59.

Two pipeline steps install packages that can change without warning. One automatic update takes new releases before a bad one can be spotted, and four buttons or links have no name a screen reader can say. Pinning what the pipeline installs, setting a waiting period for automatic updates and naming the buttons and links would close these risks. Updating the vulnerable packages would fix the package with a known security hole, and correcting the flagged pipeline settings would deal with the weakness in the build pipeline's configuration. The four labels or groups of fields with no name need connecting to their fields or naming.

The product code is 278,496 lines, about €480,000 to rebuild.

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

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

If Production Readiness rose from 42 to 62, the lowest score rated Strong, the score would rise from 52 to about 59.

Code composition: what the lines of code are
Product code 56%Tests 44%
New since the last survey: 162 findings

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

  • Cyclomatic Complexity · mcp.quote_summary (cyclomatic 40) agent/src/trading/connectors/robinhood/mcp.py
  • Cyclomatic Complexity · tool._execute_step (cyclomatic 33) agent/src/tools/paper_trade/tool.py
  • Cyclomatic Complexity · PaperTrading.PaperTrading (cyclomatic 33) frontend/src/pages/PaperTrading.tsx
  • Cyclomatic Complexity · combination.combine_factors (cyclomatic 31) agent/src/quantlib/combination.py
  • Cyclomatic Complexity · argentina_equity._field_problems (cyclomatic 30) agent/backtest/engines/argentina_equity.py
  • Cyclomatic Complexity · ResearchArtifacts.ResearchArtifacts (cyclomatic 29) frontend/src/pages/ResearchArtifacts.tsx
  • Cyclomatic Complexity · ResearchArtifactStore.save (cyclomatic 27) agent/src/research_artifacts/store.py
  • Cyclomatic Complexity · settings_routes._list_openai_codex_models (cyclomatic 24) agent/src/api/settings_routes.py
  • Cyclomatic Complexity · runner._select_market_engine (cyclomatic 22) agent/backtest/runner.py
  • Cyclomatic Complexity · data._fetch_cn_a (cyclomatic 22) agent/src/tools/paper_trade/data.py
  • Cyclomatic Complexity · figures.parse_figures_block (cyclomatic 21) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · stream_guard.supervised_pulls (cyclomatic 21) agent/src/providers/stream_guard.py
  • Cyclomatic Complexity · data.fetch_market_data (cyclomatic 21) agent/src/tools/paper_trade/data.py
  • Cyclomatic Complexity · claude_cli._decide (cyclomatic 20) agent/src/providers/claude_cli.py
  • Cyclomatic Complexity · _EvidenceMixin._record_backtest_outputs (cyclomatic 19) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_document_text (cyclomatic 19) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · result_artifacts.deliver_tool_result (cyclomatic 19) agent/src/agent/result_artifacts.py
  • Cyclomatic Complexity · schema._validate_node (cyclomatic 19) agent/src/tools/paper_trade/schema.py
  • Cyclomatic Complexity · session_5m.match_orders_5m (cyclomatic 19) agent/src/tools/paper_trade/session_5m.py
  • Cyclomatic Complexity · tool_policy.check_bash_command (cyclomatic 18) agent/src/providers/tool_policy.py
  • Cyclomatic Complexity · settings_routes._list_provider_models (cyclomatic 17) agent/src/api/settings_routes.py
  • Cyclomatic Complexity · data_availability.build_availability_contract (cyclomatic 17) agent/src/factors/data_availability.py
  • Cyclomatic Complexity · BackgroundManager._execute (cyclomatic 17) agent/src/tools/background_tools.py
  • Cyclomatic Complexity · backtest_runs_tool.list_backtest_runs (cyclomatic 17) agent/src/tools/backtest_runs_tool.py
  • Cyclomatic Complexity · SwarmTool.execute (cyclomatic 17) agent/src/tools/swarm_tool.py
  • Cyclomatic Complexity · service._sdk_config (cyclomatic 17) agent/src/trading/service.py
  • Cyclomatic Complexity · ArgentinaEquityEngine.prepare_market_data (cyclomatic 16) agent/backtest/engines/argentina_equity.py
  • Cyclomatic Complexity · llm_usage._normalize_llm_usage (cyclomatic 16) agent/src/agent/llm_usage.py
  • Cyclomatic Complexity · data_availability._source_for (cyclomatic 16) agent/src/factors/data_availability.py
  • Cyclomatic Complexity · data_5m._split_session_days (cyclomatic 16) agent/src/tools/paper_trade/data_5m.py
  • Cyclomatic Complexity · trade_journal_tool.analyze_trade_journal (cyclomatic 16) agent/src/tools/trade_journal_tool.py
  • Cyclomatic Complexity · sdk.place_order (cyclomatic 16) agent/src/trading/connectors/shoonya/sdk.py
  • Cyclomatic Complexity · service._call_remote (cyclomatic 16) agent/src/trading/service.py
  • Cognitive Complexity · mcp.quote_summary (cognitive 57) agent/src/trading/connectors/robinhood/mcp.py
  • Cognitive Complexity · PaperTrading.PaperTrading (cognitive 46) frontend/src/pages/PaperTrading.tsx
  • Cognitive Complexity · argentina_equity._field_problems (cognitive 44) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · tool._execute_step (cognitive 42) agent/src/tools/paper_trade/tool.py
  • Cognitive Complexity · settings_routes._list_openai_codex_models (cognitive 39) agent/src/api/settings_routes.py
  • Cognitive Complexity · session_5m.match_orders_5m (cognitive 39) agent/src/tools/paper_trade/session_5m.py
  • Cognitive Complexity · combination.combine_factors (cognitive 34) agent/src/quantlib/combination.py
  • Cognitive Complexity · stream_guard.supervised_pulls (cognitive 33) agent/src/providers/stream_guard.py
  • Cognitive Complexity · ResearchArtifactStore.save (cognitive 33) agent/src/research_artifacts/store.py
  • Cognitive Complexity · schema._validate_node (cognitive 30) agent/src/tools/paper_trade/schema.py
  • Cognitive Complexity · ResearchArtifacts.ResearchArtifacts (cognitive 30) frontend/src/pages/ResearchArtifacts.tsx
  • Cognitive Complexity · ArgentinaEquityEngine.prepare_market_data (cognitive 29) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · _EvidenceMixin._ingest_document_text (cognitive 28) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · combination._walk_forward_weights (cognitive 28) agent/src/quantlib/combination.py
  • Cognitive Complexity · data.fetch_market_data (cognitive 27) agent/src/tools/paper_trade/data.py
  • Cognitive Complexity · data_5m._split_session_days (cognitive 27) agent/src/tools/paper_trade/data_5m.py
  • Cognitive Complexity · argentina_equity.byma_cash_ledger (cognitive 26) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · data._fetch_cn_a (cognitive 26) agent/src/tools/paper_trade/data.py
  • Cognitive Complexity · runner._select_market_engine (cognitive 25) agent/backtest/runner.py
  • Cognitive Complexity · BackgroundManager._execute (cognitive 24) agent/src/tools/background_tools.py
  • Cognitive Complexity · result_artifacts.deliver_tool_result (cognitive 23) agent/src/agent/result_artifacts.py
  • Cognitive Complexity · argentina_equity.reconcile_ratio_changes (cognitive 22) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · engine.run_day_loop (cognitive 22) agent/src/tools/paper_trade/engine.py
  • Cognitive Complexity · SwarmTool.execute (cognitive 22) agent/src/tools/swarm_tool.py
  • Cognitive Complexity · data_availability.build_availability_contract (cognitive 21) agent/src/factors/data_availability.py
  • Cognitive Complexity · tool_policy.check_bash_command (cognitive 21) agent/src/providers/tool_policy.py
  • Cognitive Complexity · SessionService._convert_messages_to_history (cognitive 21) agent/src/session/service.py
  • Cognitive Complexity · _MatchSession._day_gate (cognitive 21) agent/src/tools/paper_trade/engine.py
  • Cognitive Complexity · data_availability._source_for (cognitive 20) agent/src/factors/data_availability.py
  • Cognitive Complexity · backtest_runs_tool.list_backtest_runs (cognitive 20) agent/src/tools/backtest_runs_tool.py
  • Cognitive Complexity · stock_news_tool._fetch_eastmoney_news (cognitive 20) agent/src/tools/stock_news_tool.py
  • Cognitive Complexity · FiguresBlock.match (cognitive 19) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · codegen._rule_to_context (cognitive 19) agent/src/shadow_account/codegen.py
  • Cognitive Complexity · argentina_equity.argentina_sell_allowed (cognitive 18) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · llm_usage._normalize_llm_usage (cognitive 18) agent/src/agent/llm_usage.py
  • Cognitive Complexity · settings_routes._list_provider_models (cognitive 18) agent/src/api/settings_routes.py
  • Cognitive Complexity · volatility.heston_price (cognitive 18) agent/src/quantlib/volatility.py
  • Cognitive Complexity · data_5m.fetch_five_minute (cognitive 18) agent/src/tools/paper_trade/data_5m.py
  • Cognitive Complexity · data_readiness._assess_five_minute_readiness (cognitive 18) agent/src/tools/paper_trade/data_readiness.py
  • Cognitive Complexity · tool._resolve_clients (cognitive 18) agent/src/tools/paper_trade/tool.py
  • Cognitive Complexity · wire.received_state_hash_from_payload (cognitive 18) agent/src/tools/paper_trade/wire.py
  • Cognitive Complexity · policies._records_at (cognitive 17) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · data._resolve_network_loader (cognitive 17) agent/src/tools/paper_trade/data.py
  • Cognitive Complexity · strategy_exec.run_strategy_path (cognitive 17) agent/src/tools/paper_trade/strategy_exec.py
  • Cognitive Complexity · service._sdk_config (cognitive 17) agent/src/trading/service.py
  • Cognitive Complexity · ArgentinaEquityEngine.__init__ (cognitive 16) agent/backtest/engines/argentina_equity.py
  • Cognitive Complexity · sessions_routes._strip_prompt_wrappers (cognitive 16) agent/src/api/sessions_routes.py
  • Cognitive Complexity · backtest_runs_tool._backtests_of (cognitive 16) agent/src/tools/backtest_runs_tool.py
  • Cognitive Complexity · service._call_remote (cognitive 16) agent/src/trading/service.py
  • God Classes · FunctionTooLong: PaperTrading.PaperTrading frontend/src/pages/PaperTrading.tsx
  • God Classes · FunctionTooLong: ResearchArtifacts.ResearchArtifacts frontend/src/pages/ResearchArtifacts.tsx
  • God Classes · FileTooLong: engines/argentina_equity.py agent/backtest/engines/argentina_equity.py
  • God Classes · ClassTooLong: PaperTrading frontend/src/pages/PaperTrading.tsx
  • God Classes · FileTooLong: session/service.py agent/src/session/service.py
  • God Classes · FileTooLong: tools/swarm_tool.py agent/src/tools/swarm_tool.py
  • God Classes · FileTooLong: tools/symbol_search_tool.py agent/src/tools/symbol_search_tool.py
  • God Classes · FileTooLong: pages/PaperTrading.tsx frontend/src/pages/PaperTrading.tsx
  • Code Duplication · Edited copy of a member (25 corresponding lines) agent/src/tools/autopilot_tool.py
  • Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/trading/connectors/alpaca/sdk.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) agent/src/trading/connectors/binance/sdk.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) agent/mcp_server.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) agent/src/trading/service.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/trading/connectors/dhan/sdk.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) agent/cli/_legacy.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) agent/src/trading/connectors/dhan/sdk.py
  • Code Duplication · Duplicated block (22 lines × 2) agent/src/quantlib/impact.py
  • Code Duplication · Duplicated block (19–20 lines × 2) agent/src/providers/llm.py

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

Fixed since the last survey: 197 findings

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

  • Cyclomatic Complexity · runner._create_market_engine (cyclomatic 22) agent/backtest/runner.py
  • Cyclomatic Complexity · claude_cli_policy.check_bash_command (cyclomatic 16) agent/src/providers/claude_cli_policy.py
  • Cognitive Complexity · runner._create_market_engine (cognitive 25) agent/backtest/runner.py
  • Cognitive Complexity · claude_cli_policy.check_bash_command (cognitive 19) agent/src/providers/claude_cli_policy.py
  • Code Duplication · Edited copy of a member (25 corresponding lines) agent/src/tools/autopilot_tool.py
  • Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/trading/connectors/alpaca/sdk.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) agent/src/trading/connectors/binance/sdk.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) agent/src/trading/service.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/cord10.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/trading/connectors/binance/sdk.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/trading/connectors/dhan/sdk.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) agent/src/trading/connectors/dhan/sdk.py
  • Code Duplication · Duplicated block (21 lines × 2) agent/src/quantlib/impact.py
  • Code Duplication · Duplicated block (14–15 lines × 2) agent/backtest/engines/composite.py
  • Code Duplication · Duplicated block (5–15 lines × 3) agent/backtest/loaders/nobitex.py
  • Code Duplication · Duplicated block (12–14 lines × 5) agent/src/trading/connectors/binance/sdk.py
  • Code Duplication · Duplicated block (7–11 lines × 2) agent/backtest/correlation.py
  • Code Duplication · Duplicated block (7 lines × 5) agent/src/factors/zoo/qlib158/cord10.py
  • Churn × Complexity Hotspots · Hotspot: frontend/src/pages/AlphaZoo.tsx frontend/src/pages/AlphaZoo.tsx
  • Churn × Complexity Hotspots · Hotspot: frontend/src/stores/agent.ts frontend/src/stores/agent.ts
  • Churn × Complexity Hotspots · Hotspot: frontend/src/pages/Compare.tsx frontend/src/pages/Compare.tsx
  • Churn × Complexity Hotspots · Hotspot: frontend/src/pages/Reports.tsx frontend/src/pages/Reports.tsx
  • Churn × Complexity Hotspots · Hotspot: frontend/src/components/charts/CandlestickChart.tsx frontend/src/components/charts/CandlestickChart.tsx
  • Churn × Complexity Hotspots · Hotspot: frontend/src/components/chat/MandateProposalCard.tsx frontend/src/components/chat/MandateProposalCard.tsx
  • Churn × Complexity Hotspots · Hotspot: frontend/src/components/chat/ToolProgressIndicator.tsx frontend/src/components/chat/ToolProgressIndicator.tsx
  • Churn × Complexity Hotspots · Hotspot: agent/src/tools/load_skill_tool.py agent/src/tools/load_skill_tool.py
  • Churn × Complexity Hotspots · Hotspot: frontend/src/components/common/ConfirmDialog.tsx frontend/src/components/common/ConfirmDialog.tsx
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/stock_profile_tool.py agent/src/tools/stock_profile_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/block_trades_tool.py agent/src/tools/block_trades_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/session/models.py agent/src/session/models.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/research_reports_tool.py agent/src/tools/research_reports_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/swarm_tool.py agent/src/tools/swarm_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/channels/utils.py agent/src/channels/utils.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/northbound_tool.py agent/src/tools/northbound_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/trading/connectors/mt5/reads.py agent/src/trading/connectors/mt5/reads.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/tools/margin_trading_tool.py agent/src/tools/margin_trading_tool.py
  • Churn × Complexity Hotspots · Repeated repair: agent/src/agent/trace.py agent/src/agent/trace.py
  • Static Analysis (SAST) · Medium: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High vulnerability: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Code Duplication · Duplicated block with local edits (61 matched lines × 2 locations) frontend/src/lib/api.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) frontend/src/components/chat/MandateProposalCard.tsx
  • Code Duplication · Duplicated block (11 lines × 3 locations) frontend/src/components/options/StrategyBuilder.tsx
  • Code Duplication · Duplicated block (11 lines × 2 locations) frontend/src/components/settings/ChannelConfigPanel.tsx
  • Code Duplication · Duplicated block (10 lines × 3 locations) frontend/src/components/charts/AnnualReturnsChart.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/components/charts/CorrelationMatrix.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/components/charts/EquityChart.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/components/options/StrategyBuilder.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/pages/AlphaZoo.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/pages/Compare.tsx
  • Code Duplication · Duplicated block (10 lines × 2 locations) frontend/src/pages/Settings.tsx
  • Code Duplication · Duplicated block (9 lines × 3 locations) frontend/src/components/charts/DistributionChart.tsx
  • Code Duplication · Duplicated block (9 lines × 2 locations) frontend/src/components/chat/GoalPanel.tsx
  • Code Duplication · Duplicated block (9 lines × 2 locations) frontend/src/lib/swarmStatus.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) frontend/src/lib/tearsheet.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) frontend/src/pages/RunDetail.tsx
  • Code Duplication · Duplicated block (9 lines × 2 locations) frontend/src/stores/agent.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) desktop/electron/scripts/smoke-lifecycle.mjs
  • Code Duplication · Duplicated block (8 lines × 4 locations) frontend/src/components/charts/AnnualReturnsChart.tsx
  • Code Duplication · Duplicated block (8 lines × 4 locations) frontend/src/components/charts/MiniEquityChart.tsx
  • Code Duplication · Duplicated block (8 lines × 2 locations) frontend/src/components/settings/ChannelSettings.tsx
  • Code Duplication · Duplicated block (8 lines × 2 locations) frontend/src/components/settings/QVerisSettings.tsx
  • Code Duplication · Duplicated block (8 lines × 2 locations) frontend/src/pages/Agent.tsx
  • Code Duplication · Duplicated block (8 lines × 2 locations) frontend/src/pages/Agent.tsx
  • Code Duplication · Duplicated block (8 lines × 3 locations) frontend/src/pages/AlphaZoo.tsx
  • Code Duplication · Duplicated block (8 lines × 6 locations) frontend/src/pages/AlphaZoo.tsx
  • Code Duplication · Duplicated block (8 lines × 2 locations) frontend/src/pages/RunDetail.tsx
  • Code Duplication · Duplicated block (8 lines × 3 locations) frontend/src/pages/Settings.tsx
  • Code Duplication · Duplicated block (7 lines × 8 locations) frontend/src/components/charts/AttributionTab.tsx
  • Code Duplication · Duplicated block (7 lines × 2 locations) frontend/src/components/charts/DistributionChart.tsx
  • Code Duplication · Duplicated block (7 lines × 2 locations) frontend/src/components/charts/FactorResearchPanel.tsx
  • Code Duplication · Duplicated block (7 lines × 2 locations) frontend/src/components/portfolio/ConnectionCenter.tsx
  • Code Duplication · Duplicated block (7 lines × 3 locations) frontend/src/components/settings/QVerisSettings.tsx
  • Code Duplication · Duplicated block (7 lines × 2 locations) frontend/src/components/settings/QVerisSettings.tsx
  • Code Duplication · Duplicated block (7 lines × 3 locations) frontend/src/pages/AlphaZoo.tsx
  • Code Duplication · Duplicated block (7 lines × 2 locations) frontend/src/pages/PixelOffice.tsx
  • Code Duplication · Duplicated block (6 lines × 2 locations) desktop/electron/src/backend-manager.ts
  • Code Duplication · Duplicated block with local edits (6 matched lines × 2 locations) frontend/src/components/chat/Composer.tsx
  • Code Duplication · Duplicated block (6 lines × 2 locations) frontend/src/components/chat/LiveRuntimePanel.tsx
  • Code Duplication · Duplicated block with local edits (6 matched lines × 2 locations) frontend/src/components/options/OptionsChainTable.tsx
  • Code Duplication · Duplicated block (6 lines × 2 locations) frontend/src/components/run/PositionsTab.tsx
  • Code Duplication · Duplicated block (6 lines × 2 locations) frontend/src/pages/Portfolio.tsx
  • Code Duplication · Duplicated block with local edits (5 matched lines × 2 locations) desktop/electron/scripts/test-update-safety.mjs
  • Code Duplication · Duplicated block (5 lines × 2 locations) frontend/src/pages/Agent.tsx
  • Cyclomatic Complexity · Complex function Settings (cyclomatic 39, cognitive 36) frontend/src/pages/Settings.tsx
Rebuild cost: about €480,000 · Estimate
Cost to rebuild€160,000 to €790,000, for 2,631 to 8,347 hours of work, about 3.3 person-years for 1 to 7 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 52. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 278,496 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 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Raises the score by about 8 points · Low effort · Secret Scanning
2
Resolve the 1 Banned license finding(s) in License Compliance.
Raises the score by about 5 points · Low effort · License Compliance
3
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 3 points · Medium effort · Security & performance tooling

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €480,000 to build again, about 3.3 person-years of work. Its weakest lens is Production Readiness, at 42 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 8 points for low effort, because it clears the 1 Secret Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 392,961 lines over the last 90 days, which is about 1,593,675 lines a year. At that pace, the extra work comes to an estimated 215.5 to 1292.8 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

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

The table shows the 40 modules with the most connections; 565 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 agent.backtest2 agent.backtest.engines.base3 agent.backtest.optimizers.base4 agent.cli5 agent.src.agent.grounding.policies6 agent.src.agent.tools7 agent.src.channels.bus.events8 agent.src.live.mandate.model9 agent.src.quantlib10 agent.src.quantlib.valuation11 agent.src.scheduled_research.models12 agent.src.session.models13 agent.src.strategy_store.models14 agent.src.tools15 agent.src.tools.paper_trade16 frontend.src.components.charts.AnnualReturnsChart17 frontend.src.lib.api18 frontend.src.lib.options19 frontend.src.types.agent20 agent.src.agent.grounding.ledger21 agent.src.agent.loop22 agent.src.api23 agent.src.channels.bus.queue24 agent.src.live25 agent.src.scheduled_research.store26 agent.src.swarm27 frontend.src.lib28 frontend.src.pages29 frontend.src.stores.agent30 agent.src.agent31 agent.src.channels.base32 frontend.src.components.chat33 agent.src.channels.dingtalk34 agent.src.channels.discord35 agent.src.channels.email36 agent.src.channels.feishu37 agent.src.channels.mochat38 agent.src.channels.qq39 agent.src.channels.websocket40 agent.src.channels
1 agent.backtest
2 agent.backtest.engines.base
3 agent.backtest.optimizers.base
4 agent.cli
5 agent.src.agent.grounding.policies
6 agent.src.agent.tools
7 agent.src.channels.bus.events
8 agent.src.live.mandate.model
9 agent.src.quantlib
10 agent.src.quantlib.valuation
11 agent.src.scheduled_research.models
12 agent.src.session.models
13 agent.src.strategy_store.models
14 agent.src.tools
15 agent.src.tools.paper_trade
16 frontend.src.components.charts.AnnualReturnsChart
17 frontend.src.lib.api
18 frontend.src.lib.options
19 frontend.src.types.agent
20 agent.src.agent.grounding.ledger2
21 agent.src.agent.loop1
22 agent.src.api11
23 agent.src.channels.bus.queue2
24 agent.src.live4
25 agent.src.scheduled_research.store1
26 agent.src.swarm1
27 frontend.src.lib412
28 frontend.src.pages9
29 frontend.src.stores.agent1
30 agent.src.agent11
31 agent.src.channels.base21
32 frontend.src.components.chat14631
33 agent.src.channels.dingtalk111
34 agent.src.channels.discord111
35 agent.src.channels.email111
36 agent.src.channels.feishu211
37 agent.src.channels.mochat111
38 agent.src.channels.qq111
39 agent.src.channels.websocket111
40 agent.src.channels11111111
Uses a module listed above itPart of a loopThe module itself
1 agent.backtest2 agent.backtest.engines.base3 agent.backtest.optimizers.base4 agent.cli5 agent.src.agent.grounding.policies6 agent.src.agent.tools7 agent.src.channels.bus.events8 agent.src.live.mandate.model9 agent.src.quantlib10 agent.src.quantlib.valuation11 agent.src.scheduled_research.models12 agent.src.session.models13 agent.src.strategy_store.models14 agent.src.tools15 agent.src.tools.paper_trade16 frontend.src.components.charts.AnnualReturnsChart17 frontend.src.lib.api18 frontend.src.lib.options19 frontend.src.types.agent20 agent.src.agent.grounding.ledger21 agent.src.agent.loop22 agent.src.api23 agent.src.channels.bus.queue24 agent.src.live25 agent.src.scheduled_research.store26 agent.src.swarm27 frontend.src.lib28 frontend.src.pages29 frontend.src.stores.agent30 agent.src.agent31 agent.src.channels.base32 frontend.src.components.chat33 agent.src.channels.dingtalk34 agent.src.channels.discord35 agent.src.channels.email36 agent.src.channels.feishu37 agent.src.channels.mochat38 agent.src.channels.qq39 agent.src.channels.websocket40 agent.src.channelsagent.backtest1agent.backtest.engines.base2agent.backtest.optimizers.base3agent.cli4agent.src.agent.grounding.policies5agent.src.agent.tools6agent.src.channels.bus.events7agent.src.live.mandate.model8agent.src.quantlib9agent.src.quantlib.valuation10agent.src.scheduled_research.models11agent.src.session.models12agent.src.strategy_store.models13agent.src.tools14agent.src.tools.paper_trade15frontend.src.components.charts.AnnualReturnsChart16frontend.src.lib.api17frontend.src.lib.options18frontend.src.types.agent19agent.src.agent.grounding.ledger20agent.src.agent.loop21agent.src.api22agent.src.channels.bus.queue23agent.src.live24agent.src.scheduled_research.store25agent.src.swarm26frontend.src.lib27frontend.src.pages28frontend.src.stores.agent29agent.src.agent30agent.src.channels.base31frontend.src.components.chat32agent.src.channels.dingtalk33agent.src.channels.discord34agent.src.channels.email35agent.src.channels.feishu36agent.src.channels.mochat37agent.src.channels.qq38agent.src.channels.websocket39agent.src.channels40211124114129111211463111111111121111111111111111111+565 more modules (most-connected shown)

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

At a glance — Architecture · 92% · Adequate · gated by D26 ·

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

At a glance — Readiness · 42% · Weak · gated by D12, P3, P7 ·

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

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

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection18High / Critical
A03:2025 — Software Supply Chain Failures14High / Critical
A07:2025 — Authentication Failures1High / Critical
A01:2025 — Broken Access Control1Medium

Roadmap

Top priorities: Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED; Resolve the 1 Banned license finding(s) in License Compliance; Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.

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

Do thisHelpsEffortDimension
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+8.1 ptsLowSecret Scanning
Resolve the 1 Banned license finding(s) in License Compliance.+4.6 ptsLowLicense Compliance
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.+2.9 ptsMediumSecurity & performance tooling
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.+2.9 ptsMediumOutbound HTTP resilience
Resolve the 1 No ADRs found finding(s) in ADR Quality.+1.3 ptsLowADR Quality
Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.+1.4 ptsMediumAsync & latency hygiene
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+1.3 ptsMediumKeyboard semantics
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.+1.3 ptsMediumA11y enforcement

File quality

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

FileScoreBandWorst signal
REDACTED4.2MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.2MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedData Compliance (PII/GDPR): Medium: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.0MixedSecret Scanning: Leaked secret: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
agent/src/skills/options-strategy/example_signal_engine.py5.7MixedCyclomatic Complexity: _ShortPremium._run (cyclomatic 17)
frontend/src/lib/api.ts5.9MixedCyclomatic Complexity: api.errorFromResponse (cyclomatic 16)
agent/src/live/enforcement.py6.0MixedExplicit Debt: TodoComment
REDACTED6.1MixedDependency Vulnerabilities: Medium CVE: REDACTED
REDACTED6.4MixedCyclomatic Complexity: DataLoader._request_page (cyclomatic 19)
REDACTED6.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED6.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED6.9MixedDependency Vulnerabilities: Medium CVE: REDACTED
frontend/src/pages/RunDetail.tsx7.0Near-cleanCyclomatic Complexity: RunDetail.RunDetail (cyclomatic 75)

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

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

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

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

Could not be resolved — 11

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 90 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 — 90 dimensions across the health lenses
D1D2D3D4D5D6D9D10D11D12D13D14D15D16D17D19D20D24D26D27D28D29D30D31D32D34D35D36D37D43D44AC1AC2AC3AC4AC5AC6AC7AX10AX3AX4AX6C2M1M2M3M4P1P10P2P3P4P5P6P7PF3R1R10R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X2X21X22X23X24X25X26X27X28X29X3X30X4X5

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, 2112 of 2141 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 01a1a3d3-2ee9-7fbc-8d66-8cb9e956a1a1.

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: this repository's production source spans .ts, .tsx, .py, and our analyzer cannot run the .py test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 81.5% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
  • 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 753 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,052 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • 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.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D32 Data Compliance (PII/GDPR) — 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. `frontend/src/components/run/PositionsTab.tsx`, `frontend/src/i18n/index.ts`, `frontend/src/pages/AlphaZoo.tsx`, `frontend/tailwind.config.ts` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AC1 Text alternatives — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC3 Page structure — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC4 Keyboard semantics — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC5 ARIA correctness — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 8 script file(s) building 27 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. frontend/src/pages/Compare.tsx, frontend/src/pages/Portfolio.tsx, frontend/src/components/run/PositionsTab.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 101 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in agent/src/scheduling/registry.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker-compose.yml). compose up failed (exit 14 — a file the compose project references is missing) — env file agent/.env not found: stat agent/.env: no such file or directory; runtime evidence skipped.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/src/tools/br_market_data_tool.py:12), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/src/tools/br_market_data_tool.py:12), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'sqlite3' is imported (agent/src/tools/br_market_data_tool.py:12), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 reads a prose claim (a path, a setting, a variable, a route, a version, a project, an install, a bare project name in a command) only in text identified as English: the cues that tell a claim from an absence, the past, a plan or an example are an English lexicon, and on other text they would let a false claim through. Links, image targets, fenced commands with an explicit path or a package-manager script, and env-fence variables are checked in every language. 'und' is text the identifier could not name (too short, mixed script, no function words).
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P8 Schema migrations — 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. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 48 further occurrence(s) are not listed individually; the score already reflects all 88.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 90 further occurrence(s) are not listed individually; the score already reflects all 130.
  • X7 Silent fallback defaults — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 8 further occurrence(s) are not listed individually; the score already reflects all 48.

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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • 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.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned REDACTED, 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.
  • D32 Data Compliance (PII/GDPR): PII/GDPR signals are heuristic pattern matches in code — they flag likely handling concerns, not legal compliance, and cannot trace where data actually flows at runtime.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity2.0 / 10Critical✓ Tool-verified

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

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

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

438 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Agent.Agent at 374.

sdk.place_order (cyclomatic 30) · ×2agent/src/trading/connectors/alpaca/sdk.py:460
Settings.Settings::submitDataSources (cyclomatic 20) · ×2frontend/src/pages/Settings.tsx:265
Agent.Agent (cyclomatic 374)frontend/src/pages/Agent.tsx:233
Scheduled.Scheduled (cyclomatic 116)frontend/src/pages/Scheduled.tsx:92
AgentLoop._run_bound (cyclomatic 104)REDACTED:387

+ 431 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 Cyclomatic Complexity — start with Agent.Agent (cyclomatic 374). — Refactoring it lifts Cyclomatic Complexity from 2.0 to about 3.5/10.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

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

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

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

663 method(s) exceeded the cognitive complexity threshold of 15; the worst was Agent.Agent at 427.

Settings.Settings::submitDataSources (cognitive 22) · ×2frontend/src/pages/Settings.tsx:265
Agent.Agent (cognitive 427)frontend/src/pages/Agent.tsx:233
AgentLoop._run_bound (cognitive 194)REDACTED:387
options_portfolio.run_options_backtest (cognitive 150)agent/backtest/engines/options_portfolio.py:199
WeixinChannel._process_message (cognitive 143)REDACTED:600

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

What to do

  1. Bring the 34 bodies over 60 down to 60 or less in Cognitive Complexity — start with Agent.Agent (cognitive 427), AgentLoop._run_bound (cognitive 194), options_portfolio.run_options_backtest (cognitive 150). — 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 34 together lifts Cognitive Complexity from 2.0 to about 3.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

142 god class(es) detected.

FileTooLong: cli/_legacy.py · ×88agent/cli/_legacy.py
FunctionTooLong: Scheduled.Scheduled · ×39frontend/src/pages/Scheduled.tsx:92
TooManyMethods: FeishuChannel · ×11agent/src/channels/feishu.py:604
ClassTooLong: Scheduled · ×4frontend/src/pages/Scheduled.tsx:1

What to do

  1. Resolve the 88 FileTooLong finding(s) in God Classes — start with sdk.py (6), service.py (3), base.py (2). — One of this dimension's main actionable groups (88 warning-level).
  2. Resolve the 39 FunctionTooLong finding(s) in God Classes — start with AlphaZoo.tsx (4), MandateProposalCard.tsx (2), Scheduled.tsx. — One of this dimension's main actionable groups (39 warning-level).
  3. Resolve the 11 TooManyMethods finding(s) in God Classes — start with feishu.py, matrix.py, telegram.py. — One of this dimension's main actionable groups (11 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

280 duplicated block group(s) detected. A further 28 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.

Duplicated block (6 lines × 2) · ×20agent/backtest/loaders/fmp_loader.py:312
Duplicated block (9 lines × 2) · ×18agent/backtest/loaders/sina_loader.py:106
Duplicated block (8 lines × 2) · ×15agent/backtest/metrics.py:625
Duplicated block (5 lines × 2) · ×15agent/backtest/run_card.py:367
Duplicated block (10 lines × 2) · ×13agent/backtest/loaders/futu.py:187

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

What to do

  1. Resolve the 20 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with _legacy.py (2), fmp_loader.py, tushare.py. — One of this dimension's main actionable groups (20 warning-level).
  2. Resolve the 18 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), sina_loader.py, _legacy.py. — One of this dimension's main actionable groups (18 warning-level).
  3. Resolve the 15 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with sdk.py (3), metrics.py, mcp_server.py. — One of this dimension's main actionable groups (15 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

5 production modules (npm+source-import), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations, and — for the source no manifest declares — its top-level source directories, with the imports between them as edges; 0 module(s) off the main sequence.

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

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

2 of 156 classes have LCOM4 above 3.

Low cohesion: BrazilEquityEngine (LCOM4 4) · ×2agent/backtest/engines/brazil_equity.py:42

What to do

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

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

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

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

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

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

13487 test methods: 13423 unit, 58 integration, 0 BDD, 6 e2e. The JavaScript/TypeScript suite contributes 753 `it`/`test` case(s) across 91 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 12734 test function(s) across 1022 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality10.0 / 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 753 tests. Measured on the JavaScript/TypeScript suite only — at least 1,052 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

Mock-dominated test: downloads PDF bytes with bearer authentication and keeps the key out of the URLfrontend/src/lib/__tests__/api.test.ts:11

✓ On the Gold path — maintain.

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

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

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

0 flaky across 2 measured tier(s). JavaScript/TypeScript (vitest via `npm ci --ignore-scripts` in frontend/ (846 tests)): measured (0 flaky); Python (repository root, 1022 test files): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene9.8 0.6 / 10Critical✓ 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 0.6 / 10 · rule-coverage 6% · ceiling Verified

5 outdated, 0 yanked pinned Python distributions. 12 of 205 shipped distributions were graded against pypi.org (0 not published there, 193 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.

Outdated: httpcore2 · ×5

What to do

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

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

D13 · Secret Scanning5.0 / 10Adequate✓ Tool-verified

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

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

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

1 secret(s) detected.

REDACTED

What to do

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

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

D14 · License 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 211 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 205 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (6 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 22 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

Banned license: python-telegram-bot

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).
  2. Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D15 · Churn × Complexity Hotspots9.4 / 10Stronggated by 209 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.4 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: REDACTED (72×104=7488); frontend/src/pages/Agent.tsx (17×374=6358); agent/src/agent/grounding/policies.py (45×49=2205) Repeated repair below the complexity floor: agent/backtest/engines/_market_hooks.py (26 of 35 changes were fixes); agent/backtest/loaders/registry.py (19 of 34 changes were fixes); agent/src/agent/context.py (19 of 28 changes were fixes)

Hotspot: REDACTED · ×144REDACTED:387
Repeated repair: agent/backtest/engines/_market_hooks.py · ×65agent/backtest/engines/_market_hooks.py:479

What to do

  1. Resolve the 144 Hotspot finding(s) in Churn × Complexity Hotspots — start with sdk.py (5), service.py (4), REDACTED (3). — One of this dimension's main actionable groups (144 warning-level).
  2. Resolve the 65 Repeated repair finding(s) in Churn × Complexity Hotspots — start with base.py (2), sdk.py (2), store.py (2). — One of this dimension's main actionable groups (65 warning-level).

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

D16 · Bus Factor9.1 / 10Exemplary✓ 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 9.1 / 10 · rule-coverage 100% · ceiling Documented

66 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is agent/src/tools/institutional_holdings_tool.py. Counted over 738 of the 1359 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 · ×5
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

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

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

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

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

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

3 deducted task-comment markers across 278496 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×3agent/src/skills/strategy-dev-manager/templates/factor_signal_engine.py:47

What to do

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

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

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

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

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

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

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

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — 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.

D24 · Comment Value9.4 9.2 / 10Exemplary✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 98% · ceiling Documented

2 of 325 judged comments only repeat the code they sit on (0.6 %). 13 comment(s) in another language or script were not judged.

redundant comment · ×2frontend/src/lib/__tests__/formatters.test.ts:107

✓ On the Gold path — maintain.

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

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

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

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

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

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

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

70 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.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)2.6 / 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 2.6 / 10 · rule-coverage 100% · ceiling Documented

18 finding(s): 0 critical, 4 high, 12 medium, 2 low. semgrep hit a parse error in 7 file(s) — `frontend/src/components/options/__tests__/OptionsChainTable.test.tsx` (line 19), `frontend/src/components/run/PositionsTab.tsx` (line 40), `frontend/src/i18n/index.ts` (line 38), `frontend/src/lib/__tests__/api.test.ts` (line 67, line 183), `frontend/src/pages/AlphaZoo.tsx` (line 1283), … (+2 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. 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 Vulnerabilities8.0 / 10Adequategated by 1 critical finding✓ Tool-verified

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

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

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

9 finding(s): 0 critical, 1 high, 7 medium, 1 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 7 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 warning-level).
  3. Resolve the 1 Low CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-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.

D32 · Data Compliance (PII/GDPR)9.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Likely personal-data (PII / GDPR) handling concerns — logging or storing data without safeguards.

Method: Heuristic PII/GDPR LEAK scan via semgrep across the repo, using our own ruleset: personal data crossing a boundary it should not — reaching a log/console sink, a URL or query string, or unprotected browser storage. Matches map to severity and a 0-10 wide normalizer. A clean sweep is unscored rather than an unearned 10, and is a statement about the leak paths checked only — this dimension does not inventory the personal data a repository holds (the personal-data map and the C1-C5 compliance cards do that), so it never reports that a repository has no personal-data surface. Reported LOUDLY as a measurement gap if the ruleset is missing from the analyzer image. Exhaustive over the leak paths, advisory-leaning; degrades on parse failure.

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

1 finding(s): 0 critical, 0 high, 1 medium, 0 low. semgrep could not parse 4 file(s) — `frontend/src/components/run/PositionsTab.tsx`, `frontend/src/i18n/index.ts`, `frontend/src/pages/AlphaZoo.tsx`, `frontend/tailwind.config.ts` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.

REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

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

D34 · Knowledge Freshness9.9 / 10Adequategated by 1 critical finding✓ 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 9.9 / 10 · rule-coverage 100% · ceiling Documented

11 of 738 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is agent/src/trading/connectors/trading212/sdk.py. Counted over 738 of the 1359 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgeagent/src/trading/connectors/trading212/sdk.py:1
Orphaned file · ×10agent/backtest/engines/korea_equity.py:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with sdk.py. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 10 Orphaned file finding(s) in Knowledge Freshness — start with profiles.py (3), korea_equity.py, context_injector.py. — One of this dimension's main actionable groups (10 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling10.0 / 10Stronggated by 1 serious finding✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: api.ts↔router.tsx 50%

Change coupling: api.ts ↔ router.tsxfrontend/src/lib/api.ts:1

What to do

  1. Resolve the 1 Change coupling finding(s) in Change Coupling — start with api.ts. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged

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

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

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

AC2 · Forms & labels7.5 / 10Strong✓ Tool-verified

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

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

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

  • A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×4) — desktop/electron/src/loading.html:38, desktop/electron/src/loading.html:39, frontend/src/components/chat/Composer.tsx:280, …
  • A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. (×4) — frontend/src/components/chat/RunnerBudgetControls.tsx:48, frontend/src/components/portfolio/ConnectionCenter.tsx:228, frontend/src/pages/PixelOffice.tsx:86, …
  • This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×4) — frontend/src/pages/Compare.tsx:336, frontend/src/pages/Compare.tsx:352, frontend/src/pages/Correlation.tsx:96, …

What to do

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

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

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

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

  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — agent/src/shadow_account/templates/shadow_report.html:2
  • A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×2) — frontend/src/components/charts/StrategyResearchDashboard.tsx:287, frontend/src/components/run/RunCard.tsx:55
  • Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. (×3) — frontend/src/pages/AlphaZoo.tsx:243, wiki/alpha-library/index.html:121, wiki/tutorials/index.html:66

What to do

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

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

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

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

  • This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — frontend/src/components/chat/PineScriptViewer.tsx:51
  • This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — frontend/src/components/portfolio/ConnectionCenter.tsx:133, frontend/src/components/portfolio/PortfolioSourceEditor.tsx:96

What to do

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

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

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

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

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

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

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

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

  • `.bar` moves (`animation: loading 1.25s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — desktop/electron/src/loading.html:20
  • <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — frontend/src/components/chat/Composer.tsx:420
  • <div> moves — its `animate-[pulse-slide_2s_ease-in-out_infinite]` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — frontend/src/components/chat/SwarmStatusCard.tsx:42
  • <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — frontend/src/pages/Reports.tsx:112
  • `.alpha-zoo-card` moves (`transition: border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — wiki/alpha-library/index.html:42
  • `thead th` sets color: #5f6878 on background-color: #1a1f29 — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — agent/src/shadow_account/templates/shadow_report.css:250
  • `.docs-article` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — wiki/docs/styles.css:112
  • `.knowledge-card` moves (`transition: border-color 160ms ease, transform 160ms ease, background 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — wiki/styles.css:498
  • `.pixel-character__typing` moves (`animation: pixel-typing 900ms steps(2, end) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — frontend/src/index.css:185

What to do

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

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

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

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

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

What to do

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

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

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

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

What to do

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

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

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

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

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

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

AX6 · Interface segregation10.0 / 10Exemplary✓ Tool-verified

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

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

C2 · Access Controls7.0 / 10Strong✓ Tool-verified

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.

  • Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.

What to do

  • Name the access rules — DRF permission classes, django-guardian or django-rules permissions, a casbin or oso policy, or roles and permissions declared once — and consult them where access is checked (permission_classes, @permission_required, Depends), so the rule set is reviewable and testable on its own.
M1 · Documentation (README)9.0 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Add a README to the 1 of 2 project(s) that lack one — worth up to 1 pts.
M2 · Architecture documentation0.0 / 10Critical✓ 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.
  • No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.

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.
  • Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

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

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

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

What to do

  • Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

P2 · Observability8.5 / 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 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `desktop/electron`.

What to do

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

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

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

  • No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 29130 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — .github/workflows/desktop-windows.yml:13

What to do

  • Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback8.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.

  • Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.

What to do

  • Add an approval/environment gate (required reviewers / protection rules) before production promotion.
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified

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

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

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

  • `httpx.AsyncClient(` 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. — agent/src/api/custom_provider_routes.py:104
  • `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×16) — agent/src/skills/candlestick/example_signal_engine.py:551, agent/src/skills/chanlun/example_signal_engine.py:196, agent/src/skills/elliott-wave/example_signal_engine.py:429, …
  • `urllib.request.urlopen(` 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. — tools/build_report_font.py:39

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `start` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — agent/src/channels/feishu.py:713
  • `mkdirSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/electron/src/backend-manager.ts:94
  • `existsSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — desktop/electron/src/backend-manager.ts:124

What to do

  • Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.
  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety9.2 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication8.7 / 10Strong✓ Tool-verified

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

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

  • 24 duplicated blocks under frontend/src/ have copies in at least two of the sibling directories components, lib, pages — 10 of them are reported below, and 14 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 24 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 24 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 24 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — frontend/src/components/charts/RegimeTimeline.tsx:121
  • desktop/electron/scripts/build-review-installer.mjs:34 · desktop/electron/scripts/build-signed-installer.mjs:43 — the two spans are one implementation copied and then locally edited — 581 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/electron/scripts/build-review-installer.mjs:34
  • frontend/src/lib/api.ts:554 · frontend/src/lib/api.ts:723 — the two spans are one implementation copied and then locally edited — 501 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/lib/api.ts:554
  • frontend/src/pages/Settings.tsx:642 · frontend/src/pages/Settings.tsx:677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/Settings.tsx:642
  • frontend/src/pages/AlphaZoo.tsx:717 · frontend/src/pages/AlphaZoo.tsx:1097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/AlphaZoo.tsx:717
  • frontend/src/pages/Compare.tsx:258 · frontend/src/pages/Compare.tsx:289 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/Compare.tsx:258
  • frontend/src/pages/PaperTrading.tsx:295 · frontend/src/pages/PaperTrading.tsx:426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/PaperTrading.tsx:295
  • frontend/src/components/chat/Composer.tsx:350 · frontend/src/components/chat/Composer.tsx:370 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/chat/Composer.tsx:350
  • frontend/src/components/charts/RegimeTimeline.tsx:121 · frontend/src/pages/Compare.tsx:209 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/RegimeTimeline.tsx:121
  • frontend/src/pages/PaperTrading.tsx:256 · frontend/src/pages/PaperTrading.tsx:383 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — frontend/src/pages/PaperTrading.tsx:256
  • desktop/electron/scripts/process-sentinel.mjs:34 · desktop/electron/src/backend-manager.ts:521 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — desktop/electron/scripts/process-sentinel.mjs:34
  • frontend/src/lib/swarmStatus.ts:306 · frontend/src/lib/swarmStatus.ts:326 · frontend/src/lib/swarmStatus.ts:345 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/lib/swarmStatus.ts:306
  • frontend/src/pages/Settings.tsx:493 · frontend/src/pages/Settings.tsx:643 · frontend/src/pages/Settings.tsx:678 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/Settings.tsx:493
  • frontend/src/pages/Agent.tsx:1095 · frontend/src/pages/Agent.tsx:1133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/Agent.tsx:1095
  • frontend/src/pages/Reports.tsx:161 · frontend/src/pages/Runtime.tsx:113 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — frontend/src/pages/Reports.tsx:161
  • frontend/src/pages/Runtime.tsx:516 · frontend/src/pages/Scheduled.tsx:76 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — frontend/src/pages/Runtime.tsx:516
  • frontend/src/pages/Settings.tsx:250 · frontend/src/pages/Settings.tsx:294 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/Settings.tsx:250
  • frontend/src/pages/Settings.tsx:608 · frontend/src/pages/Settings.tsx:710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/Settings.tsx:608
  • frontend/src/components/charts/AttributionCumulativeChart.tsx:24 · frontend/src/components/charts/RollingBetaAlphaChart.tsx:23 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/AttributionCumulativeChart.tsx:24
  • frontend/src/components/charts/CandlestickChart.tsx:94 · frontend/src/components/charts/MiniEquityChart.tsx:38 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/CandlestickChart.tsx:94
  • frontend/src/components/charts/EquityChart.tsx:32 · frontend/src/components/charts/WalkForwardChart.tsx:31 — the two spans are one implementation copied and then locally edited — 87 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/components/charts/EquityChart.tsx:32
  • frontend/src/pages/Agent.tsx:1077 · frontend/src/pages/Agent.tsx:1116 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/Agent.tsx:1077
  • frontend/src/components/charts/EquityChart.tsx:32 · frontend/src/components/charts/RegimeTimeline.tsx:39 — the two spans are one implementation copied and then locally edited — 84 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/components/charts/EquityChart.tsx:32
  • frontend/src/components/charts/FactorResearchPanel.tsx:193 · frontend/src/components/charts/StrategyResearchDashboard.tsx:196 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/FactorResearchPanel.tsx:193
  • frontend/src/components/chat/Composer.tsx:236 · frontend/src/components/layout/Layout.tsx:40 — the two spans are one implementation copied and then locally edited — 77 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/components/chat/Composer.tsx:236
  • frontend/src/components/chat/Composer.tsx:236 · frontend/src/components/layout/SidebarNavigation.tsx:15 — the two spans are one implementation copied and then locally edited — 78 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/components/chat/Composer.tsx:236
  • frontend/src/pages/Agent.tsx:1522 · frontend/src/pages/Agent.tsx:1627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/Agent.tsx:1522
  • frontend/src/pages/AlphaZoo.tsx:272 · frontend/src/pages/AlphaZoo.tsx:288 · frontend/src/pages/AlphaZoo.tsx:306 — 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. — frontend/src/pages/AlphaZoo.tsx:272
  • frontend/src/pages/AlphaZoo.tsx:667 · frontend/src/pages/AlphaZoo.tsx:1048 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/AlphaZoo.tsx:667
  • frontend/src/components/charts/CandlestickChart.tsx:213 · frontend/src/pages/Compare.tsx:151 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/CandlestickChart.tsx:213
  • frontend/src/components/charts/FactorResearchPanel.tsx:18 · frontend/src/components/charts/StrategyResearchDashboard.tsx:18 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/FactorResearchPanel.tsx:18
  • frontend/src/components/charts/MonteCarloPathsChart.tsx:124 · frontend/src/components/charts/WalkForwardChart.tsx:92 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/components/charts/MonteCarloPathsChart.tsx:124
  • frontend/src/components/layout/Layout.tsx:114 · frontend/src/components/layout/Layout.tsx:128 — the two spans are one implementation copied and then locally edited — 92 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — frontend/src/components/layout/Layout.tsx:114
  • frontend/src/lib/chart-theme.ts:5 · frontend/src/lib/pnl-colors.ts:14 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — frontend/src/lib/chart-theme.ts:5
  • frontend/src/pages/Settings.tsx:81 · frontend/src/pages/Settings.tsx:95 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — frontend/src/pages/Settings.tsx:81
  • frontend/src/pages/Settings.tsx:510 · frontend/src/pages/Settings.tsx:662 · frontend/src/pages/Settings.tsx:697 — all 3 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — frontend/src/pages/Settings.tsx:510
  • frontend/src/pages/Settings.tsx:534 · frontend/src/pages/Settings.tsx:547 · frontend/src/pages/Settings.tsx:560 — 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. — frontend/src/pages/Settings.tsx:534
  • desktop/electron/src/backend-manager.ts:480 · desktop/electron/src/backend-watchdog.ts:128 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — desktop/electron/src/backend-manager.ts:480
  • frontend/src/components/charts/MonteCarloPathsChart.tsx:9 · frontend/src/components/charts/RegimeTimeline.tsx:8 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — frontend/src/components/charts/MonteCarloPathsChart.tsx:9
  • frontend/src/components/charts/ValidationPanel.tsx:68 · frontend/src/components/charts/ValidationPanel.tsx:117 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — frontend/src/components/charts/ValidationPanel.tsx:68

What to do

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

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

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

  • (anonymous) has cyclomatic complexity 45 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Agent.tsx:546
  • OptionsLab has cyclomatic complexity 44 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/OptionsLab.tsx:58
  • Settings has cyclomatic complexity 43 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Settings.tsx:41
  • RunDetail has cyclomatic complexity 41 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/RunDetail.tsx:124
  • attempt.completed has cyclomatic complexity 39 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Agent.tsx:952
  • Scheduled has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Scheduled.tsx:92
  • BrokerRow has cyclomatic complexity 37 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/chat/RunnerStatus.tsx:121
  • ChannelConfigPanel has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/settings/ChannelConfigPanel.tsx:193
  • ConnectionCard has cyclomatic complexity 34 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/portfolio/ConnectionCenter.tsx:169
  • renderField has cyclomatic complexity 31 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/settings/ChannelConfigPanel.tsx:534
  • Portfolio has cyclomatic complexity 30 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Portfolio.tsx:135
  • MandateProposalCard has cyclomatic complexity 26 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/chat/MandateProposalCard.tsx:203
  • applySwarmEvent has cyclomatic complexity 26 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/lib/swarmStatus.ts:209
  • Agent has cyclomatic complexity 26 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Agent.tsx:233
  • ToolRow has cyclomatic complexity 25 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/chat/ToolProgressIndicator.tsx:128
  • Layout has cyclomatic complexity 25 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/layout/Layout.tsx:21
  • buildPayoffRequest has cyclomatic complexity 24 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/lib/options.ts:181
  • (anonymous) has cyclomatic complexity 23 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Agent.tsx:1438
  • CustomProviderManager has cyclomatic complexity 23 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/settings/CustomProviderManager.tsx:20
  • compareSemanticVersions has cyclomatic complexity 21 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/electron/src/update-verification.ts:229

What to do

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

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

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

  • frontend/src/lib/api.ts has 2070 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/lib/api.ts:1
  • frontend/src/pages/Agent.tsx has 1910 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Agent.tsx:1
  • frontend/src/pages/AlphaZoo.tsx has 1212 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/AlphaZoo.tsx:1
  • frontend/src/pages/RunDetail.tsx has 1141 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/RunDetail.tsx:1
  • frontend/src/components/settings/ChannelConfigPanel.tsx has 820 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/settings/ChannelConfigPanel.tsx:1
  • frontend/src/pages/Scheduled.tsx has 818 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Scheduled.tsx:1
  • frontend/src/pages/Settings.tsx has 702 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Settings.tsx:1
  • frontend/src/pages/Portfolio.tsx has 659 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Portfolio.tsx:1
  • frontend/src/pages/Runtime.tsx has 607 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Runtime.tsx:1
  • frontend/src/pages/PaperTrading.tsx has 569 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/PaperTrading.tsx:1
  • frontend/src/components/run/PositionsTab.tsx has 564 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/run/PositionsTab.tsx:1
  • desktop/electron/src/backend-manager.ts has 495 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/electron/src/backend-manager.ts:1
  • frontend/src/components/layout/Layout.tsx has 493 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/layout/Layout.tsx:1
  • frontend/src/components/chat/Composer.tsx has 486 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/chat/Composer.tsx:1
  • frontend/src/lib/swarmStatus.ts has 483 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/lib/swarmStatus.ts:1
  • frontend/src/pages/Compare.tsx has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/pages/Compare.tsx:1
  • frontend/src/components/chat/MandateProposalCard.tsx has 435 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/chat/MandateProposalCard.tsx:1
  • frontend/src/components/chat/WelcomeScreen.tsx has 402 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — frontend/src/components/chat/WelcomeScreen.tsx:1

What to do

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

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

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

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×20) — desktop/electron/src/update-verification.ts:1, desktop/electron/scripts/test-update-safety.mjs:1, desktop/electron/src/main.ts:1, …

What to do

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

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

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

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · Tooling6.7 / 10Strong✓ Tool-verified

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

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

  • test ✓ · lint ✗ · typecheck ✓ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.

What to do

  • Add eslint as package.json scripts and run them in CI.
R7 · Dead Code9.7 / 10Exemplary✓ Tool-verified

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

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

  • Unreachable from the 21 application, 13 tooling and 99 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (21 application, 13 tooling, 99 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×4) — desktop/electron/src/backend-watchdog.ts, wiki/functions/api/stats.js, wiki/functions/_middleware.js, …

What to do

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

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

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

  • Imported but not declared in any reachable package.json — installs work only by hoisting accident. — desktop/electron/scripts/prepare-electron.mjs:15
  • Declared in frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×2)

What to do

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

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

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

S1 · Web-Security Posture9.5 / 10Exemplary✓ Tool-verified

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

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

  • Set: Content-Security-Policy, Permissions-Policy, Referrer-Policy, X-Content-Type-Options, X-Frame-Options. Missing: Strict-Transport-Security — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−0.5 on this card.) — wiki/_headers:1

What to do

  • Add Strict-Transport-Security beside the headers already set; Content-Security-Policy is the one that pays for itself first, then Strict-Transport-Security, then nosniff and a frame policy.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • `execute` is public, takes a document from its caller (line 331) and hands it to `_decode`, which calls itself at line 168 (`_decode`) with a piece of `value` (and at line 170) — and nowhere in `_decode` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_decode` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/quantlib_tool.py:168
  • `redact_payload` is public and takes `obj: Any` from its caller, and it calls itself at line 389 (`redact_payload`) with a piece of `obj` (and at line 393) — and nowhere in `redact_payload` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `redact_payload` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/redaction.py:389
  • `redact_payload` is public, takes a document from its caller (line 354) and hands it to `_redact_token_usage`, which calls itself at line 423 (`_redact_token_usage`) with a piece of `value` — and nowhere in `_redact_token_usage` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_redact_token_usage` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/redaction.py:423
  • `validate_payload` is public, takes a document from its caller (line 652) and hands it to `_validate_node`, which calls itself at line 640 (`_validate_node`) with a piece of `instance` (and at line 649) — and nowhere in `_validate_node` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate_node` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/paper_trade/schema.py:640
  • `canonicalize` is public and takes `value: Any` from its caller, and it calls itself at line 154 (`canonicalize`) with a piece of `value` — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/paper_trade/state_hash.py:154
  • `with_security_warnings` is public, takes a document from its caller (line 177) and hands it to `_iter_selected_targets`, which calls itself at line 244 (`_iter_selected_targets`) with a piece of `container` (and at line 253) — and nowhere in `_iter_selected_targets` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_iter_selected_targets` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/security/scanner.py:244
  • `contains_pdf_password` is public and takes `value: Any` from its caller, and it calls itself at line 187 (`contains_pdf_password`) with a piece of `value` (and at line 191) — and nowhere in `contains_pdf_password` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains_pdf_password` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/scheduled_research/models.py:187
  • `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 99 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/scheduled_research/verdict.py:99
  • `compute_input_hash` is public, takes a document from its caller (line 518) and hands it to `_flatten`, which calls itself at line 441 (`_flatten`) with a piece of `value` (and at line 442, line 443, line 444, line 469, line 479) — and nowhere in `_flatten` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_flatten` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/quantlib/valuation/artifact.py:441
  • `contains` is public and takes `observed: Any` from its caller, and it calls itself at line 17 (`contains`) with a piece of `observed` (and at line 24) — and nowhere in `contains` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/evals/harness/observations.py:17
  • `render_tool_event` is public, takes a document from its caller (line 150) and hands it to `_render_value`, which calls itself at line 109 (`_render_value`) with a piece of `value` — and nowhere in `_render_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_render_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/cli/components/tool_event.py:109
  • `write_run_card` is public, takes a document from its caller (line 168) and hands it to `_json_safe`, which calls itself at line 368 (`_json_safe`) with a piece of `value` (and at line 370) — and nowhere in `_json_safe` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/backtest/run_card.py:368
  • `write_validation_json` is public, takes a document from its caller (line 503) and hands it to `_json_safe`, which calls itself at line 491 (`_json_safe`) with a piece of `value` (and at line 493, line 497, line 499) — and nowhere in `_json_safe` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/backtest/validation.py:491

What to do

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

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

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

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

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

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

X2 · Cancellation propagation7.0 / 10Strong✓ Tool-verified

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

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

  • Only 4/8 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `loadZh` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — wiki/site.js:49
  • `getPypi` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — wiki/functions/api/stats.js:13
  • `withAuthTicket` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — frontend/src/lib/apiAuth.ts:36
  • `requestJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — frontend/src/components/settings/QVerisSettings.tsx:49

What to do

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

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

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

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

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

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

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

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

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

X24 · Document value interpolated into markup unescaped7.4 / 10Strong✓ Tool-verified

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

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

  • `messages?.[html]??original` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — wiki/site.js:71

What to do

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

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

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

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

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

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

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

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

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

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

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

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

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

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

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

X3 · Exception handling6.8 / 10Strong✓ Tool-verified

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×31) — wiki/main.js:23, wiki/main.js:34, wiki/site.js:44, …
  • `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×7) — wiki/site.js:247, wiki/functions/_middleware.js:66, wiki/functions/api/stats.js:34, …
  • `.then(…, () => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. — frontend/src/pages/RunDetail.tsx:1176
  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — agent/src/ui_services.py:61

What to do

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

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

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

X4 · Structured logging7.8 / 10Strong✓ Tool-verified

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

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

  • `info` at line 608 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:608
  • `info` at line 618 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:618
  • `exception` at line 1158 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:1158
  • `warning` at line 234 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — agent/src/agent/tool_lifecycle.py:234
  • `info` at line 532 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — agent/src/agent/tool_lifecycle.py:532

What to do

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

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

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

  • ~1.0 `!` null assertions per 1k TypeScript source lines — 32 assertion(s) across the 30551 source line(s) of the 127 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: frontend/src/components/chat/ToolProgressIndicator.tsx (8), frontend/src/lib/indicators.ts (7), frontend/src/components/charts/ValidationPanel.tsx (3). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

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

WCAG coverage — what static analysis assessed

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

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

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

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health66%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture92%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity60%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness42%Weak — gated by D12, P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security78%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility56%Adequate — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateStrongest area.
Unscored — 3 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 17 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Not assessed: this repository stores data through 'sqlite3' (agent/src/tools/br_market_data_tool.py:12) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and MongoEngine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
  • C4 Data Retention — Not assessed: this repository stores data through 'sqlite3' (agent/src/tools/br_market_data_tool.py:12) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, SQL schemas). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
  • C5 Data-Subject Rights — Not assessed: this repository stores data through 'sqlite3' (agent/src/tools/br_market_data_tool.py:12) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
Not included — 36 check(s) not relevant to this codebase

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

  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No 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. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — compose up failed (exit 14 — a file the compose project references is missing) — env file agent/.env not found: stat agent/.env: no such file or directory; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; JavaScript, Python, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python 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 (agent), 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"]`.
  • D25 ADR Conformance — no ADRs to check
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • 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 — polyglot repository, one half has no runner
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 288 value object(s); 1 domain event(s); its domain events are published by services or handlers — no domain entity raises one; no aggregate is declared and no domain structure surrounds the state-guarding types: not claimed as DDD
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • P8 Schema migrations — Peewee is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
  • P9 Domain vs controller coverage — coverage data present for 25 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not applicable: Python and TypeScript/JavaScript runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 17 finding(s)
AC2 · Forms & labels · <button> with no accessible text · ×4
  • <button> with no accessible text desktop/electron/src/loading.html:38 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text desktop/electron/src/loading.html:39 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text frontend/src/components/chat/Composer.tsx:280 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text frontend/src/components/chat/Composer.tsx:291 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels · <label> that labels no control · ×4
  • <label> that labels no control frontend/src/pages/Compare.tsx:336 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control frontend/src/pages/Compare.tsx:352 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control frontend/src/pages/Correlation.tsx:96 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control frontend/src/pages/Correlation.tsx:118 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D13 · Secret Scanning · Leaked secret · ×1
  • REDACTED
D14 · License Compliance · Banned license · ×1
  • Banned license: python-telegram-bot — `python-telegram-bot` 22.8 is published on PyPI under `LGPL-3.0-only`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge agent/src/trading/connectors/trading212/sdk.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
R8 · Dependency Hygiene · Unlisted import '@electron/get' · ×1
  • Unlisted import '@electron/get' desktop/electron/scripts/prepare-electron.mjs:15 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Serious — 1994 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×144
  • Hotspot: REDACTED REDACTED:387 — REDACTED changed 72 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in AgentLoop._run_bound at line 387. 52 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/pages/Agent.tsx frontend/src/pages/Agent.tsx:233 — frontend/src/pages/Agent.tsx changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 374 in Agent.Agent at line 233. 10 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/pages/Agent.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/agent/grounding/policies.py agent/src/agent/grounding/policies.py:1888 — agent/src/agent/grounding/policies.py changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in _PolicyMixin._derivation at line 1888. 37 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/agent/grounding/policies.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/cli/_legacy.py agent/cli/_legacy.py:6742 — agent/cli/_legacy.py changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in _legacy.main at line 6742. 14 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/cli/_legacy.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/backtest/engines/base.py agent/backtest/engines/base.py:1255 — agent/backtest/engines/base.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in BaseEngine._execute_bars at line 1255. 24 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/backtest/runner.py agent/backtest/runner.py:2017 — agent/backtest/runner.py changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in runner.fetch_data_map at line 2017. 26 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/runner.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/agent/grounding/figures.py agent/src/agent/grounding/figures.py:1224 — agent/src/agent/grounding/figures.py changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in figures.scan_figures at line 1224. 23 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/agent/grounding/figures.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/components/settings/ChannelConfigPanel.tsx frontend/src/components/settings/ChannelConfigPanel.tsx:193 — frontend/src/components/settings/ChannelConfigPanel.tsx changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in ChannelConfigPanel.ChannelConfigPanel at line 193. 4 of those changes were fix/bug commits, and the other 7 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/components/settings/ChannelConfigPanel.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/pages/RunDetail.tsx frontend/src/pages/RunDetail.tsx:124 — frontend/src/pages/RunDetail.tsx changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in RunDetail.RunDetail at line 124. 9 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/pages/RunDetail.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/providers/llm.py agent/src/providers/llm.py:1645 — agent/src/providers/llm.py changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in llm.build_llm at line 1645. 22 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/providers/llm.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/mcp_server.py agent/mcp_server.py:1008 — agent/mcp_server.py changed 54 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in mcp_server.alpha_bench at line 1008. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/mcp_server.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/backtest/engines/options_portfolio.py agent/backtest/engines/options_portfolio.py:703 — agent/backtest/engines/options_portfolio.py changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in options_portfolio._calc_options_metrics at line 703. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/options_portfolio.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/pages/Portfolio.tsx frontend/src/pages/Portfolio.tsx:135 — frontend/src/pages/Portfolio.tsx changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in Portfolio.Portfolio at line 135. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/pages/Portfolio.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/swarm/worker.py agent/src/swarm/worker.py:612 — agent/src/swarm/worker.py changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in worker._run_worker_impl at line 612. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/swarm/worker.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/portfolio/service.py agent/src/portfolio/service.py:960 — agent/src/portfolio/service.py changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in PortfolioService._collect_source at line 960. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/portfolio/service.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/lib/api.ts frontend/src/lib/api.ts:401 — frontend/src/lib/api.ts changed 56 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in api.errorFromResponse at line 401. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/lib/api.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/pages/Scheduled.tsx frontend/src/pages/Scheduled.tsx:92 — frontend/src/pages/Scheduled.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in Scheduled.Scheduled at line 92. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/pages/Scheduled.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: frontend/src/pages/Settings.tsx frontend/src/pages/Settings.tsx:41 — frontend/src/pages/Settings.tsx changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in Settings.Settings at line 41. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/pages/Settings.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/tools/symbol_search_tool.py agent/src/tools/symbol_search_tool.py:546 — agent/src/tools/symbol_search_tool.py changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in symbol_search_tool._search_selected_connector at line 546. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/tools/symbol_search_tool.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/agent/grounding/evidence.py agent/src/agent/grounding/evidence.py:1056 — agent/src/agent/grounding/evidence.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in _EvidenceMixin._ingest_engine_table at line 1056. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/agent/grounding/evidence.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/market_data.py agent/src/market_data.py:199 — agent/src/market_data.py changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in market_data.fetch_market_data at line 199. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/market_data.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/tools/alpha_bench_tool.py agent/src/tools/alpha_bench_tool.py:1268 — agent/src/tools/alpha_bench_tool.py changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in alpha_bench_tool.run_alpha_bench at line 1268. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/tools/alpha_bench_tool.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/scheduled_research/models.py agent/src/scheduled_research/models.py:313 — agent/src/scheduled_research/models.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in ScheduledResearchJob.from_dict at line 313. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/scheduled_research/models.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/channels/email.py agent/src/channels/email.py:265 — agent/src/channels/email.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in EmailChannel.send at line 265. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/channels/email.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: agent/src/api/runs_routes.py agent/src/api/runs_routes.py:680 — agent/src/api/runs_routes.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in runs_routes._build_response_from_run_dir at line 680. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/api/runs_routes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 119 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×88
  • FileTooLong: cli/_legacy.py agent/cli/_legacy.py — FileTooLong — 5001 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4501 over it, 10.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: grounding/policies.py agent/src/agent/grounding/policies.py — FileTooLong — 1751 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1251 over it, 3.50× 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: lib/api.ts frontend/src/lib/api.ts — FileTooLong — 1720 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1220 over it, 3.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: channels/feishu.py agent/src/channels/feishu.py — FileTooLong — 1705 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1205 over it, 3.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: engines/base.py agent/backtest/engines/base.py — FileTooLong — 1595 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1095 over it, 3.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: pages/Agent.tsx frontend/src/pages/Agent.tsx — FileTooLong — 1541 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1041 over it, 3.08× 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/mcp_server.py agent/mcp_server.py — FileTooLong — 1469 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 969 over it, 2.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backtest/runner.py agent/backtest/runner.py — FileTooLong — 1350 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 850 over it, 2.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: channels/telegram.py agent/src/channels/telegram.py — FileTooLong — 1319 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 819 over it, 2.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/institutional_holdings_tool.py agent/src/tools/institutional_holdings_tool.py — FileTooLong — 1278 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 778 over it, 2.56× 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: trading/service.py agent/src/trading/service.py — FileTooLong — 1195 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 695 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1155 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 655 over it, 2.31× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1129 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 629 over it, 2.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: providers/llm.py agent/src/providers/llm.py — FileTooLong — 1118 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 618 over it, 2.24× 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: grounding/evidence.py agent/src/agent/grounding/evidence.py — FileTooLong — 1057 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 557 over it, 2.11× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: pages/AlphaZoo.tsx frontend/src/pages/AlphaZoo.tsx — FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded). 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: tools/etf_holdings_tool.py agent/src/tools/etf_holdings_tool.py — FileTooLong — 1016 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 516 over it, 2.03× 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: quantlib/fundmath.py agent/src/quantlib/fundmath.py — FileTooLong — 1012 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 512 over it, 2.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: pages/RunDetail.tsx frontend/src/pages/RunDetail.tsx — FileTooLong — 1008 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 508 over it, 2.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/alpha_bench_tool.py agent/src/tools/alpha_bench_tool.py — FileTooLong — 988 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 488 over it, 1.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 964 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 464 over it, 1.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 949 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 449 over it, 1.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: channels/email.py agent/src/channels/email.py — FileTooLong — 933 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 433 over it, 1.87× 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: api/live_routes.py agent/src/api/live_routes.py — FileTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded). 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: cli/main.py agent/cli/main.py — FileTooLong — 902 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 402 over it, 1.80× 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.
  • + 63 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×65
  • Repeated repair: agent/backtest/engines/_market_hooks.py agent/backtest/engines/_market_hooks.py:479 — agent/backtest/engines/_market_hooks.py changed 35 times in last 90 days and 26 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 _market_hooks.calc_crypto_funding_fee at line 479), 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(backtest): read Yahoo three-letter =X forex symbols as USD pairs”; “fix: complete review repairs for the ten integrated PRs”; “fix: preserve financial precision and invalidate stale portfolio aggregates”; “fix(backtest): give Yahoo =X forex pairs their own spread and swap rates”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/_market_hooks.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/registry.py agent/backtest/loaders/registry.py:629 — agent/backtest/loaders/registry.py changed 34 times in last 90 days and 19 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 registry.get_loader_cls_with_fallback at line 629), 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: complete October 11-12 maintenance and research updates”; “fix(loaders): retire mootdx from the default A-share chain and health canary”; “fix(loaders): a one-bar plateau at the window edge refuses the conversion”; “fix(loaders): refuse identity relabels and share the frame caliber everywhere”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/registry.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/agent/context.py agent/src/agent/context.py:387 — agent/src/agent/context.py changed 28 times in last 90 days and 19 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 ContextBuilder.build_messages at line 387), 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(agent): recover from native claude-cli tool attempts”; “fix: complete October 11-12 maintenance and research updates”; “fix(context): keep system prompt byte-stable across runs for prefix cache”; “fix(grounding): recover container refs and multi-call field refs with value-matched leaf hints”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/agent/context.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/engines/global_futures.py agent/backtest/engines/global_futures.py:138 — agent/backtest/engines/global_futures.py changed 10 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is global_futures._extract_product at line 138), 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(backtest): apply the equity-index price limit to MYM and M2K”; “fix(backtest): report the global futures leverage default”; “fix: complete review repairs for the ten integrated PRs”; “fix(backtest): price micro equity-index contracts at the micro rate”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/global_futures.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/api/sessions_routes.py agent/src/api/sessions_routes.py:56 — agent/src/api/sessions_routes.py changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is sessions_routes._strip_prompt_wrappers at line 56), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(session): keep deletion retryable when search purge fails”; “fix(sessions): auto-title sessions whose first message is wrapped”; “fix(session): preserve live updates while generating conversation titles”; “fix(session): synchronize renamed conversation titles with search”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/api/sessions_routes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/yahoo_loader.py agent/backtest/loaders/yahoo_loader.py:210 — agent/backtest/loaders/yahoo_loader.py changed 13 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 6 (its worst body is DataLoader.fetch at line 210), 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: complete October 11-12 maintenance and research updates”; “fix(loaders): a BYMA line enters the ARS pool only when it is declared ARS (#1576)”; “fix(loaders): preserve Yahoo quote currency”; “fix(market-data): align symbol search and fetch for FX pairs and indexes”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/yahoo_loader.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/channels/config_meta.py agent/src/channels/config_meta.py:396 — agent/src/channels/config_meta.py changed 13 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 6 (its worst body is config_meta._derive_hints at line 396), 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(channels): keep redacting url userinfo when the authority has whitespace”; “fix(channels): strip URL userinfo when the port cannot be parsed”; “fix(channels): finish trusted email delivery and scheduling workflows”; “fix(channels): plain IMAP upgrades with STARTTLS before the password goes out”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/channels/config_meta.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/akshare_loader.py agent/backtest/loaders/akshare_loader.py:126 — agent/backtest/loaders/akshare_loader.py 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 9 (its worst body is DataLoader.fetch at line 126), 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(akshare): probe both forex symbol-map layouts after akshare 1.20 move”; “fix(loaders): support Akshare 1.20 forex symbols”; “fix(loaders): try the amex and nyse arca market id for akshare us bars”; “fix(loaders): a one-bar plateau at the window edge refuses the conversion”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/akshare_loader.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/tools/trading_connector_tool.py agent/src/tools/trading_connector_tool.py:443 — agent/src/tools/trading_connector_tool.py 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 10 (its worst body is TradingHistoryTool.execute at line 443), 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): reject ambiguous boolean flags before changing state”; “fix(etoro): reject copy trading on demo with a clear error”; “fix(etoro): use instrumentTypeIds for asset-class browse”; “fix(etoro): browse crypto via market-data instrumentTypeId”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/tools/trading_connector_tool.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/tools/mcp.py agent/src/tools/mcp.py:661 — agent/src/tools/mcp.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MCPServerAdapter._build_client at line 661), 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(mcp): remove redundant payload copies before agent-context consumption”; “fix(tools): MCP tool schemas with a malformed properties field no longer lose the properties key entirely”; “fix(ibkr): support official MCP OAuth and reads”; “fix: support IBKR public MCP OAuth”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/tools/mcp.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/stooq_loader.py agent/backtest/loaders/stooq_loader.py:268 — agent/backtest/loaders/stooq_loader.py changed 6 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 10 (its worst body is stooq_loader._parse_csv at line 268), 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(loaders): ask Stooq for class shares by their hyphenated ticker”; “fix(loaders): make the stooq latch see every refusal, and probe once”; “fix(loaders): make the stooq challenge latch stop probing, not just logging”; “fix(stooq): name the override variable the config layer actually reads”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/stooq_loader.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/engines/crypto.py agent/backtest/engines/crypto.py:511 — agent/backtest/engines/crypto.py 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 9 (its worst body is CryptoEngine._execute_open_order at line 511), 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(backtest): stop default spot funding and honor crypto commission”; “fix(backtest): mark halted positions at last traded close, not entry cost”; “fix(backtest): fill liquidation at the adverse mark used for its check (#1291)”; “fix(backtest): settle perpetual funding by bar span on 8h+ intervals”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/crypto.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: frontend/src/components/chat/WelcomeScreen.tsx frontend/src/components/chat/WelcomeScreen.tsx:255 — frontend/src/components/chat/WelcomeScreen.tsx changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is WelcomeScreen.WelcomeScreen at line 255), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(welcome): lay the welcome screen out for the 768px chat column it renders in”; “fix(welcome): drop duplicated cards, the thrice-repeated hint and a static counter”; “fix(welcome): make side-panel examples clickable and label each by its category”; “fix(welcome): align welcome copy to the reading direction in RTL locales”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- frontend/src/components/chat/WelcomeScreen.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/cli/onboard.py agent/cli/onboard.py:270 — agent/cli/onboard.py changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is onboard._select_numeric at line 270), 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(onboarding): refresh the Flash suggestion without changing the default tier”; “fix(agent): size context compaction to the model's real window”; “fix: complete September 27 reviews and surface verified run-card evidence”; “fix(onboard): write .env.partial atomically so a failed save cannot destroy recovery state”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/cli/onboard.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/factors/base.py agent/src/factors/base.py:99 — agent/src/factors/base.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is base.zscore_by_group at line 99), 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(factors): use OLS for Qlib BETA and RESI (#2062)”; “fix(factors): weight the most recent bar heaviest in decay_linear”; “fix(factors): make ts_argmax/ts_argmin tie-breaking backend-independent”; “fix(factors): comparison gates stop reading a missing input as a verdict (#1463)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/factors/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/governance/ledger.py agent/src/governance/ledger.py:369 — agent/src/governance/ledger.py 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 9 (its worst body is ledger.append_record at line 369), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): preserve Unicode records and handoff summaries”; “fix: complete review repairs for the ten integrated PRs”; “fix(governance): verify the whole history before sealing a ledger segment”; “fix(governance): make archive ledger verification report corruption instead of crashing”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/governance/ledger.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/tushare.py agent/backtest/loaders/tushare.py:331 — agent/backtest/loaders/tushare.py 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 14 (its worst body is DataLoader._fetch_minutes at line 331), 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(loaders): report tushare minute volume in the declared board lots”; “fix(loaders): serve futures from a chain that implements them”; “fix(data): declare per-market volume units in market-data provenance”; “fix(data): repair HK fallback routing + tencent HK source (closes #998, #999) (#1000)”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/tushare.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/goal/policy.py agent/src/goal/policy.py:60 — agent/src/goal/policy.py 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 3 (its worst body is policy.reject_live_execution_objective at line 60), 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(goal): keep long-term and short-term objectives”; “fix: complete September 27 reviews and surface verified run-card evidence”; “fix(goal): reject execution objectives that put the immediacy cue before the verb”; “fix(goal): an objective that is an order is still refused after #1562”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/goal/policy.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/strategy_store/metrics.py agent/src/strategy_store/metrics.py:29 — agent/src/strategy_store/metrics.py 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 12 (its worst body is metrics.compute_decay_metrics at line 29), 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(sdm): record bench history so decay monitoring has data to read”; “fix: finish research prompts and grouped validation boundaries”; “fix(sdm): stop treating overlapping IC windows as an unchanged ratio”; “fix(sdm): fix IC ratio sign flip for a negative baseline”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/strategy_store/metrics.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/loaders/baostock_loader.py agent/backtest/loaders/baostock_loader.py:251 — agent/backtest/loaders/baostock_loader.py 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 11 (its worst body is DataLoader._fetch_one at line 251), 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(loaders): preserve bounded BaoStock 0.9.4 connections”; “fix: complete September 28 reliability reviews and broker documentation”; “fix(loaders): bound baostock socket IO with a per-read deadline”; “fix(data): normalize baostock volume to board lots + consistency guard”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/loaders/baostock_loader.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/live/runtime/flatten.py agent/src/live/runtime/flatten.py:321 — agent/src/live/runtime/flatten.py 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 11 (its worst body is flatten._flatten_open_positions at line 321), 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(live): stop active attempts and isolate durable schedules”; “fix(live): harden the preemptive halt sweep against ledger failures and malformed broker records”; “fix(live): inter-process sweep claim, durable-write audit, nested broker errors”; “fix(live): reject broker read-error envelopes in the halt sweep”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/live/runtime/flatten.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/live/runtime/sweep_latch.py agent/src/live/runtime/sweep_latch.py:200 — agent/src/live/runtime/sweep_latch.py 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 sweep_latch.sweep_already_fired at line 200), 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(live): latch only the swept episodes under per-episode latch files”; “fix(live): record all active halt episodes; wrap latch write in double-failure branch”; “fix(live): episode-key the sweep claim — orphan claims never block future trips”; “fix(live): inter-process sweep claim, durable-write audit, nested broker errors”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/live/runtime/sweep_latch.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/strategy_store/sqlite_store.py agent/src/strategy_store/sqlite_store.py:378 — agent/src/strategy_store/sqlite_store.py 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 7 (its worst body is SqliteStrategyStore.register_artifact at line 378), 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(sdm): deduplicate copied bench measurements atomically”; “fix(sdm): record bench history so decay monitoring has data to read”; “fix(strategy_store): break created_at ties so history is really newest first”; “fix(store): guard _json_loads against corrupted JSON in database columns”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/src/strategy_store/sqlite_store.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/risk_xray.py agent/backtest/risk_xray.py:87 — agent/backtest/risk_xray.py changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is risk_xray.compute_risk_xray at line 87), 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(risk-xray): measure downside deviation as zero-target RMS over all bars”; “fix: Compute risk-xray returns before calendar alignment so missing prices cannot fabricate multi-bar one-period returns.”; “fix(risk-xray): honor bars_per_year=None in cross-market annualization”; “fix(metrics): anchor drawdown to initial equity”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/risk_xray.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/backtest/engines/china_a.py agent/backtest/engines/china_a.py:103 — agent/backtest/engines/china_a.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is china_a._blocked_by_limit at line 103), 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(china-a): size STAR Market and Beijing buys on their own order grid”; “fix: preserve financial precision and invalidate stale portfolio aggregates”; “fix(china-a): apply board price limits to 301, 689 and Beijing 920 codes”; “fix(backtest): enforce A-share and India rules through composite state”. 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-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 02:53:04 +08:00' --until='2026-11-03 02:53:04 +08:00' --full-history --no-merges -- agent/backtest/engines/china_a.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 40 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×39
  • FunctionTooLong: Scheduled.Scheduled frontend/src/pages/Scheduled.tsx:92 — FunctionTooLong — Scheduled runs 643 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 543 over it, 6.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Settings.Settings frontend/src/pages/Settings.tsx:41 — FunctionTooLong — Settings runs 602 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 502 over it, 6.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: PaperTrading.PaperTrading frontend/src/pages/PaperTrading.tsx:18 — FunctionTooLong — PaperTrading runs 488 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 388 over it, 4.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ChannelConfigPanel.ChannelConfigPanel frontend/src/components/settings/ChannelConfigPanel.tsx:193 — FunctionTooLong — ChannelConfigPanel runs 477 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 377 over it, 4.77× 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: Layout.Layout frontend/src/components/layout/Layout.tsx:21 — FunctionTooLong — Layout runs 304 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 204 over it, 3.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Portfolio.Portfolio frontend/src/pages/Portfolio.tsx:135 — FunctionTooLong — Portfolio runs 298 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 198 over it, 2.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: AlphaZoo.BrowseView frontend/src/pages/AlphaZoo.tsx:143 — FunctionTooLong — BrowseView runs 278 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 178 over it, 2.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ChannelSettings.ChannelSettings frontend/src/components/settings/ChannelSettings.tsx:24 — FunctionTooLong — ChannelSettings runs 254 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 154 over it, 2.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: QVerisSettings.QVerisSettings frontend/src/components/settings/QVerisSettings.tsx:80 — FunctionTooLong — QVerisSettings runs 239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: SourcePrioritySettings.SourcePrioritySettings frontend/src/components/settings/SourcePrioritySettings.tsx:24 — FunctionTooLong — SourcePrioritySettings runs 227 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 127 over it, 2.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: CandlestickChart.CandlestickChart frontend/src/components/charts/CandlestickChart.tsx:37 — FunctionTooLong — CandlestickChart runs 221 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 121 over it, 2.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: StrategyBuilder.StrategyBuilder frontend/src/components/options/StrategyBuilder.tsx:24 — FunctionTooLong — StrategyBuilder runs 220 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 120 over it, 2.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: GoalPanel.GoalPanel frontend/src/components/chat/GoalPanel.tsx:61 — FunctionTooLong — GoalPanel runs 206 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 106 over it, 2.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: MandateProposalCard.MandateProposalCard frontend/src/components/chat/MandateProposalCard.tsx:203 — FunctionTooLong — MandateProposalCard runs 205 significant lines (blank, comment-only and punctuation-only lines excluded) 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: PositionsTab.PositionsTab frontend/src/components/run/PositionsTab.tsx:97 — FunctionTooLong — PositionsTab runs 190 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 90 over it, 1.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: RunnerStatus.BrokerRow frontend/src/components/chat/RunnerStatus.tsx:121 — FunctionTooLong — BrokerRow runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ResearchArtifacts.ResearchArtifacts frontend/src/pages/ResearchArtifacts.tsx:66 — FunctionTooLong — ResearchArtifacts runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: agent.useAgentStore frontend/src/stores/agent.ts:120 — FunctionTooLong — useAgentStore runs 164 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× 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: OptionsLab.OptionsLab frontend/src/pages/OptionsLab.tsx:58 — FunctionTooLong — OptionsLab runs 161 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Reports.Reports frontend/src/pages/Reports.tsx:23 — FunctionTooLong — Reports runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Correlation.Correlation frontend/src/pages/Correlation.tsx:11 — FunctionTooLong — Correlation runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: CustomProviderManager.CustomProviderManager frontend/src/components/settings/CustomProviderManager.tsx:20 — FunctionTooLong — CustomProviderManager runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) 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: FactorResearchPanel.FactorResearchPanel frontend/src/components/charts/FactorResearchPanel.tsx:84 — FunctionTooLong — FactorResearchPanel runs 153 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× 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: WelcomeScreen.WelcomeScreen frontend/src/components/chat/WelcomeScreen.tsx:255 — FunctionTooLong — WelcomeScreen runs 147 significant lines (blank, comment-only and punctuation-only lines excluded) 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: Runtime.Runtime frontend/src/pages/Runtime.tsx:25 — FunctionTooLong — Runtime runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× 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.
  • + 14 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×39
  • Swallowed exception (empty catch) wiki/main.js:23 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/main.js:34 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/site.js:44 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/site.js:171 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/site.js:202 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/site.js:247 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) wiki/theme-init.js:28 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/_middleware.js:66 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/_middleware.js:69 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/api/stats.js:34 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/api/stats.js:38 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/api/stats.js:49 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) wiki/functions/api/stats.js:72 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/pages/Agent.tsx:1046 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) frontend/src/pages/Agent.tsx:1399 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) frontend/src/pages/Agent.tsx:1574 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) frontend/src/pages/PaperTrading.tsx:119 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/pages/RunDetail.tsx:1176 — `.then(…, () => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) frontend/src/lib/attachments.ts:47 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/lib/storage.ts:18 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/lib/storage.ts:26 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/hooks/useAlphaJob.ts:39 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/hooks/useAlphaJob.ts:43 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/hooks/useAlphaJob.ts:53 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) frontend/src/hooks/useAnalysisState.ts:10 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×20
  • Duplicated block (6 lines × 2) agent/backtest/loaders/fmp_loader.py:312 — agent/backtest/loaders/fmp_loader.py:312-317 | agent/backtest/loaders/tickerall_loader.py:442-447 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) agent/backtest/loaders/tushare.py:246 — agent/backtest/loaders/tushare.py:246-251 | agent/backtest/loaders/tushare.py:378-383 — both copies are in the same file, so extract the block into 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) agent/cli/_legacy.py:4098 — agent/cli/_legacy.py:4098-4103 | agent/cli/_legacy.py:4319-4324 — both copies are in the same file, so extract the block into 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) agent/cli/_legacy.py:5024 — agent/cli/_legacy.py:5024-5029 | agent/cli/_legacy.py:5050-5055 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) agent/cli/commands/chat.py:128 — agent/cli/commands/chat.py:128-133 | agent/cli/commands/goal.py:359-364 — 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) agent/src/factors/base.py:207 — agent/src/factors/base.py:207-212 | agent/src/factors/base.py:401-406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) agent/src/factors/zoo/gtja191/alpha_003.py:49 — agent/src/factors/zoo/gtja191/alpha_003.py:49-54 | agent/src/factors/zoo/gtja191/alpha_059.py:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) agent/src/factors/zoo/gtja191/alpha_009.py:49 — agent/src/factors/zoo/gtja191/alpha_009.py:49-54 | agent/src/factors/zoo/gtja191/alpha_068.py:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) agent/src/factors/zoo/gtja191/alpha_011.py:49 — agent/src/factors/zoo/gtja191/alpha_011.py:49-54 | agent/src/factors/zoo/gtja191/alpha_060.py:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) agent/src/factors/zoo/gtja191/alpha_049.py:56 — agent/src/factors/zoo/gtja191/alpha_049.py:56-61 | agent/src/factors/zoo/gtja191/alpha_050.py: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 `agent/src/factors/zoo/gtja191/alpha_049.py:56` it begins part-way through the construct above it, so those exact lines 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) agent/src/pixel_agents/cli.py:20 — agent/src/pixel_agents/cli.py:20-25 | agent/src/pixel_agents/cli.py:28-33 — both copies are in the same file, so extract the block into 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) agent/src/providers/llm.py:1300 — agent/src/providers/llm.py:1300-1305 | REDACTED:65-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) agent/src/quantlib/attribution.py:332 — agent/src/quantlib/attribution.py:332-337 | agent/src/quantlib/attribution.py:443-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) agent/src/quantlib/combination.py:83 — agent/src/quantlib/combination.py:83-88 | agent/src/quantlib/neutralization.py:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) agent/src/tools/goal_tool.py:306 — agent/src/tools/goal_tool.py:306-311 | agent/src/tools/goal_tool.py:375-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/tools/goal_tool.py:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/tools/goal_tool.py:304` calls `_coerce_audit_rows`, `get`, `str` and `agent/src/tools/goal_tool.py:374` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) agent/src/tools/trade_journal_parsers.py:359 — agent/src/tools/trade_journal_parsers.py:359-364 | agent/src/tools/trade_journal_parsers.py:440-445 — both copies are in the same file, so extract the block into 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) agent/src/memory/search_index.py:230 — agent/src/memory/search_index.py:230-237 | agent/src/session/search.py:173-178 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) agent/src/trading/connectors/toss/sdk.py:432 — agent/src/trading/connectors/toss/sdk.py:432-437 | agent/src/trading/connectors/trading212/sdk.py:385-390 — `agent/src/trading/connectors/toss/sdk.py` and `agent/src/trading/connectors/trading212/sdk.py` 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 6 separate duplicated blocks between them, totalling at least 61 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `TossConfig | None = None` in one and `Trading212Config | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) agent/src/factors/zoo/gtja191/alpha_116.py:64 — agent/src/factors/zoo/gtja191/alpha_116.py:64-69 | agent/src/factors/zoo/gtja191/alpha_147.py:65-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/factors/zoo/gtja191/alpha_147.py:64` calls `ts_mean` and `agent/src/factors/zoo/gtja191/alpha_116.py:63` 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 (6 lines × 2) agent/src/tools/pattern_tool.py:215 — agent/src/tools/pattern_tool.py:215-220 | agent/src/tools/pattern_tool.py:223-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
R4 · Test Coverage · No test reaches this file · ×20
  • No test reaches this file desktop/electron/src/update-verification.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/scripts/test-update-safety.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/src/main.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/site.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/src/update-recovery.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/src/backend-watchdog.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/scripts/build-signed-installer.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/scripts/build-review-installer.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/functions/api/stats.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file frontend/src/router.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/functions/_middleware.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file frontend/src/pages/Home.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/scripts/check_docs_parity.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/alpha-library/alpha.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/main.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file frontend/src/main.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file wiki/theme-init.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file frontend/public/theme-boot.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/src/preload.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/electron/scripts/copy-static.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×18
  • Duplicated block (9 lines × 2) agent/backtest/loaders/sina_loader.py:106 — agent/backtest/loaders/sina_loader.py:106-114 | REDACTED:219-227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) agent/cli/_legacy.py:4771 — agent/cli/_legacy.py:4771-4779 | agent/cli/_legacy.py:4822-4830 — both copies are in the same file, so extract the block into 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) agent/mcp_server.py:683 — agent/mcp_server.py:683-691 | agent/mcp_server.py:792-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) agent/src/api/sessions_routes.py:595 — agent/src/api/sessions_routes.py:595-603 | agent/src/api/sessions_routes.py:697-705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/api/sessions_routes.py:595` it begins part-way through the construct above it, so those exact lines 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) agent/src/api/system_routes.py:465 — agent/src/api/system_routes.py:465-473 | agent/src/api/system_routes.py:480-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) REDACTED:147 — REDACTED:147-155 | REDACTED:334-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.
  • Duplicated block (9 lines × 2) REDACTED:157 — REDACTED:157-165 | agent/src/channels/telegram.py:244-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) REDACTED:167 — REDACTED:167-175 | agent/src/channels/telegram.py:254-262 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) REDACTED:711 — REDACTED:711-719 | REDACTED:754-762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) agent/src/factors/zoo/gtja191/alpha_003.py:56 — agent/src/factors/zoo/gtja191/alpha_003.py:56-64 | agent/src/factors/zoo/gtja191/alpha_059.py:56-64 — 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 `agent/src/factors/zoo/gtja191/alpha_003.py:56` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) agent/src/quantlib/risk.py:275 — agent/src/quantlib/risk.py:275-283 | agent/src/quantlib/risk.py:484-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) agent/src/skills/tushare/scripts/fund_data_example.py:71 — agent/src/skills/tushare/scripts/fund_data_example.py:71-79 | agent/src/skills/tushare/scripts/stock_data_example.py:71-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) agent/src/strategy_discovery/models.py:236 — agent/src/strategy_discovery/models.py:236-244 | agent/src/strategy_discovery/models.py:276-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) agent/src/tools/financial_rigor_tool.py:221 — agent/src/tools/financial_rigor_tool.py:221-229 | agent/src/tools/financial_rigor_tool.py:233-241 — both copies are in the same file, so extract the block into 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) agent/src/tools/goal_tool.py:289 — agent/src/tools/goal_tool.py:289-297 | agent/src/tools/goal_tool.py:360-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) agent/src/trading/connectors/ibkr/local.py:428 — agent/src/trading/connectors/ibkr/local.py:428-436 | agent/src/trading/connectors/ibkr/local.py:489-497 — both copies are in the same file, so extract the block into 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) agent/src/trading/connectors/shoonya/sdk.py:455 — agent/src/trading/connectors/shoonya/sdk.py:455-463 | agent/src/trading/connectors/zerodha/sdk.py:585-593 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (9 lines × 2) agent/src/goal/store.py:250 — agent/src/goal/store.py:250-258 | agent/src/strategy_store/sqlite_store.py:276-284 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×18
  • Outbound HTTP without resilience agent/src/api/custom_provider_routes.py:104 — `httpx.AsyncClient(` 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 agent/src/skills/candlestick/example_signal_engine.py:551 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/chanlun/example_signal_engine.py:196 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/elliott-wave/example_signal_engine.py:429 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/harmonic/example_signal_engine.py:446 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/ichimoku/example_signal_engine.py:150 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/multi-factor/example_signal_engine.py:185 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/okx-market/scripts/candle_data_example.py:29 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/okx-market/scripts/candle_data_example.py:60 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/okx-market/scripts/market_data_example.py:24 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/okx-market/scripts/market_data_example.py:51 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/okx-market/scripts/market_data_example.py:80 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/pair-trading/example_signal_engine.py:124 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/seasonal/example_signal_engine.py:114 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/smc/example_signal_engine.py:38 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/technical-basic/example_signal_engine.py:262 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience agent/src/skills/volatility/example_signal_engine.py:129 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience tools/build_report_font.py:39 — `urllib.request.urlopen(` 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.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×15
  • Duplicated block (8 lines × 2) agent/backtest/metrics.py:625 — agent/backtest/metrics.py:625-632 | agent/backtest/metrics.py:688-695 — both copies are in the same file, so extract the block into 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) agent/mcp_server.py:483 — agent/mcp_server.py:483-490 | agent/src/tools/goal_tool.py:48-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `agent/mcp_server.py:483` it does not close everything it opens, so those exact lines 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) agent/src/api/connection_routes.py:114 — agent/src/api/connection_routes.py:114-121 | agent/src/api/connection_routes.py:134-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) agent/src/api/sessions_routes.py:731 — agent/src/api/sessions_routes.py:731-738 | agent/src/api/sessions_routes.py:747-758 — both copies are in the same file, so extract the block into 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) agent/src/factors/base.py:234 — agent/src/factors/base.py:234-245 | agent/src/factors/base.py:253-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) agent/src/live/mandate/commit.py:179 — agent/src/live/mandate/commit.py:179-186 | agent/src/live/runtime/reconcile.py:601-608 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) agent/src/quantlib/valuation/dcf.py:1028 — agent/src/quantlib/valuation/dcf.py:1028-1035 | agent/src/quantlib/valuation/dcf.py:1133-1140 — both copies are in the same file, so extract the block into 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) agent/src/skills/elliott-wave/example_signal_engine.py:306 — agent/src/skills/elliott-wave/example_signal_engine.py:306-313 | agent/src/skills/elliott-wave/example_signal_engine.py:338-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) agent/backtest/risk_xray.py:38 — agent/backtest/risk_xray.py:38-45 | agent/src/tools/backtest_summary.py:205-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) agent/cli/commands/chat.py:101 — agent/cli/commands/chat.py:101-113 | agent/cli/commands/research_playbook.py:373-380 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) agent/src/factors/zoo/alpha101/alpha_003.py:55 — agent/src/factors/zoo/alpha101/alpha_003.py:55-62 | agent/src/factors/zoo/gtja191/alpha_105.py:54-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) agent/src/factors/zoo/alpha101/alpha_013.py:55 — agent/src/factors/zoo/alpha101/alpha_013.py:55-62 | agent/src/factors/zoo/alpha101/alpha_016.py:55-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) agent/src/trading/connectors/alpaca/sdk.py:864 — agent/src/trading/connectors/alpaca/sdk.py:864-871 | agent/src/trading/connectors/binance/sdk.py: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `AlpacaConfig` in one and `BinanceConfig` 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) agent/src/trading/connectors/toss/sdk.py:578 — agent/src/trading/connectors/toss/sdk.py:578-585 | agent/src/trading/connectors/trading212/sdk.py:482-489 — `agent/src/trading/connectors/toss/sdk.py` and `agent/src/trading/connectors/trading212/sdk.py` 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 6 separate duplicated blocks between them, totalling at least 61 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `TossConfig` in one and `Trading212Config` 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) agent/src/trading/connectors/kis/sdk.py:898 — agent/src/trading/connectors/kis/sdk.py:898-905 | agent/src/trading/connectors/longbridge/sdk.py: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `KISConfig` in one and `LongbridgeConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×15
  • Duplicated block (5 lines × 2) agent/backtest/run_card.py:367 — agent/backtest/run_card.py:367-371 | agent/src/tools/backtest_summary.py:197-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) agent/src/agent/context_compact.py:145 — agent/src/agent/context_compact.py:145-149 | agent/src/agent/context_compact.py:158-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) REDACTED:130 — REDACTED:130-134 | agent/src/channels/telegram.py:221-225 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) agent/src/factors/zoo/gtja191/alpha_055.py:58 — agent/src/factors/zoo/gtja191/alpha_055.py:58-62 | agent/src/factors/zoo/gtja191/alpha_137.py:70-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/factors/zoo/gtja191/alpha_055.py:57` calls `abs` and `agent/src/factors/zoo/gtja191/alpha_137.py:69` 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) agent/src/factors/zoo/gtja191/alpha_063.py:49 — agent/src/factors/zoo/gtja191/alpha_063.py:49-53 | agent/src/factors/zoo/gtja191/alpha_067.py:49-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) agent/src/factors/zoo/gtja191/alpha_172.py:76 — agent/src/factors/zoo/gtja191/alpha_172.py:76-80 | agent/src/factors/zoo/gtja191/alpha_186.py:76-80 — 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) agent/src/quantlib/crossvalidation.py:596 — agent/src/quantlib/crossvalidation.py:596-600 | agent/src/quantlib/crossvalidation.py:615-619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/crossvalidation.py:596` it begins part-way through the construct above it, so those exact lines 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) agent/src/quantlib/timeseries.py:223 — agent/src/quantlib/timeseries.py:223-227 | agent/src/quantlib/timeseries.py:362-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) agent/src/skills/event-driven/example_signal_engine.py:50 — agent/src/skills/event-driven/example_signal_engine.py:50-54 | agent/src/skills/fundamental-filter/example_signal_engine.py:86-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) agent/src/tools/trading_connector_tool.py:406 — agent/src/tools/trading_connector_tool.py:406-410 | agent/src/tools/trading_connector_tool.py:448-452 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) agent/src/trading/connectors/dhan/sdk.py:103 — agent/src/trading/connectors/dhan/sdk.py:103-107 | agent/src/trading/connectors/zerodha/sdk.py:100-104 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 `agent/src/trading/connectors/dhan/sdk.py:103` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) agent/src/channels/qq.py:87 — agent/src/channels/qq.py:87-91 | REDACTED:31-35 — 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) agent/src/goal/store.py:933 — agent/src/goal/store.py:933-937 | agent/src/research_artifacts/store.py:154-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) agent/backtest/loaders/mootdx_loader.py:229 — agent/backtest/loaders/mootdx_loader.py:229-233 | agent/backtest/loaders/mootdx_loader.py:257-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/backtest/loaders/mootdx_loader.py:256` calls `sort_index` and `agent/backtest/loaders/mootdx_loader.py:228` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) agent/src/tools/paper_trade/engine.py:309 — agent/src/tools/paper_trade/engine.py:309-313 | agent/src/tools/paper_trade/engine.py:321-325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×13
  • Duplicated block (10 lines × 2) agent/backtest/loaders/futu.py:187 — agent/backtest/loaders/futu.py:187-196 | agent/backtest/loaders/longbridge.py:292-301 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) agent/src/agent/grounding/identity.py:674 — agent/src/agent/grounding/identity.py:674-683 | agent/src/agent/grounding/identity.py:693-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/api/system_routes.py:315 — agent/src/api/system_routes.py:315-324 | agent/src/api/system_routes.py:361-370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) agent/src/channelsui/cli_apps_api.py:9 — agent/src/channelsui/cli_apps_api.py:9-18 | agent/src/channelsui/mcp_presets_api.py:9-18 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/live/order_guard.py:952 — agent/src/live/order_guard.py:952-961 | agent/src/live/sdk_order_gate.py:1107-1116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/live/runtime/jobstore.py:175 — agent/src/live/runtime/jobstore.py:175-184 | agent/src/scheduled_research/store.py:242-251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) agent/src/skills/elliott-wave/example_signal_engine.py:217 — agent/src/skills/elliott-wave/example_signal_engine.py:217-226 | agent/src/skills/elliott-wave/example_signal_engine.py:340-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/skills/elliott-wave/example_signal_engine.py:213 — agent/src/skills/elliott-wave/example_signal_engine.py:213-222 | agent/src/skills/elliott-wave/example_signal_engine.py:249-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/skills/elliott-wave/example_signal_engine.py:253 — agent/src/skills/elliott-wave/example_signal_engine.py:253-262 | agent/src/skills/elliott-wave/example_signal_engine.py:308-317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/skills/fundamental-filter/example_signal_engine.py:117 — agent/src/skills/fundamental-filter/example_signal_engine.py:117-126 | agent/src/skills/multi-factor/example_signal_engine.py:159-168 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) agent/src/trading/connectors/etoro/copy_trading.py:53 — agent/src/trading/connectors/etoro/copy_trading.py:53-62 | agent/src/trading/connectors/etoro/copy_trading.py:85-94 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/src/trading/connectors/toss/sdk.py:545 — agent/src/trading/connectors/toss/sdk.py:545-554 | agent/src/trading/connectors/trading212/sdk.py:442-451 — `agent/src/trading/connectors/toss/sdk.py` and `agent/src/trading/connectors/trading212/sdk.py` 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 6 separate duplicated blocks between them, totalling at least 61 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) agent/cli/commands/session.py:26 — agent/cli/commands/session.py:26-35 | agent/cli/commands/show.py:41-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×13
  • Recursive walk over a caller-supplied document has no depth cap agent/src/tools/quantlib_tool.py:168 — `execute` is public, takes a document from its caller (line 331) and hands it to `_decode`, which calls itself at line 168 (`_decode`) with a piece of `value` (and at line 170) — and nowhere in `_decode` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_decode` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/tools/redaction.py:389 — `redact_payload` is public and takes `obj: Any` from its caller, and it calls itself at line 389 (`redact_payload`) with a piece of `obj` (and at line 393) — and nowhere in `redact_payload` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `redact_payload` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/tools/redaction.py:423 — `redact_payload` is public, takes a document from its caller (line 354) and hands it to `_redact_token_usage`, which calls itself at line 423 (`_redact_token_usage`) with a piece of `value` — and nowhere in `_redact_token_usage` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_redact_token_usage` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/tools/paper_trade/schema.py:640 — `validate_payload` is public, takes a document from its caller (line 652) and hands it to `_validate_node`, which calls itself at line 640 (`_validate_node`) with a piece of `instance` (and at line 649) — and nowhere in `_validate_node` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate_node` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/tools/paper_trade/state_hash.py:154 — `canonicalize` is public and takes `value: Any` from its caller, and it calls itself at line 154 (`canonicalize`) with a piece of `value` — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/security/scanner.py:244 — `with_security_warnings` is public, takes a document from its caller (line 177) and hands it to `_iter_selected_targets`, which calls itself at line 244 (`_iter_selected_targets`) with a piece of `container` (and at line 253) — and nowhere in `_iter_selected_targets` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_iter_selected_targets` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/scheduled_research/models.py:187 — `contains_pdf_password` is public and takes `value: Any` from its caller, and it calls itself at line 187 (`contains_pdf_password`) with a piece of `value` (and at line 191) — and nowhere in `contains_pdf_password` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains_pdf_password` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/scheduled_research/verdict.py:99 — `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 99 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/src/quantlib/valuation/artifact.py:441 — `compute_input_hash` is public, takes a document from its caller (line 518) and hands it to `_flatten`, which calls itself at line 441 (`_flatten`) with a piece of `value` (and at line 442, line 443, line 444, line 469, line 479) — and nowhere in `_flatten` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_flatten` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/evals/harness/observations.py:17 — `contains` is public and takes `observed: Any` from its caller, and it calls itself at line 17 (`contains`) with a piece of `observed` (and at line 24) — and nowhere in `contains` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `contains` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/cli/components/tool_event.py:109 — `render_tool_event` is public, takes a document from its caller (line 150) and hands it to `_render_value`, which calls itself at line 109 (`_render_value`) with a piece of `value` — and nowhere in `_render_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_render_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/backtest/run_card.py:368 — `write_run_card` is public, takes a document from its caller (line 168) and hands it to `_json_safe`, which calls itself at line 368 (`_json_safe`) with a piece of `value` (and at line 370) — and nowhere in `_json_safe` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap agent/backtest/validation.py:491 — `write_validation_json` is public, takes a document from its caller (line 503) and hands it to `_json_safe`, which calls itself at line 491 (`_json_safe`) with a piece of `value` (and at line 493, line 497, line 499) — and nowhere in `_json_safe` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_json_safe` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D3 · God Classes · TooManyMethods · ×11
  • TooManyMethods: FeishuChannel agent/src/channels/feishu.py:604 — 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: MatrixChannel agent/src/channels/matrix.py:215 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TelegramChannel agent/src/channels/telegram.py:423 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: _PolicyMixin agent/src/agent/grounding/policies.py:450 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BaseEngine agent/backtest/engines/base.py:508 — TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EmailChannel agent/src/channels/email.py:106 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SignalChannel REDACTED:360 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MochatChannel agent/src/channels/mochat.py:259 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WeixinChannel REDACTED:135 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WebSocketChannel REDACTED:265 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SlackChannel agent/src/channels/slack.py:72 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×11
  • Duplicated block (7 lines × 2) agent/backtest/engines/composite.py:38 — agent/backtest/engines/composite.py:38-44 | agent/backtest/engines/composite.py:59-65 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/engines/composite.py:38` it begins part-way through the construct above it, so those exact lines 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) agent/backtest/engines/composite.py:360 — agent/backtest/engines/composite.py:360-366 | agent/backtest/engines/crypto.py:644-650 — 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) agent/backtest/loaders/nobitex.py:275 — agent/backtest/loaders/nobitex.py:275-281 | agent/backtest/loaders/wallex.py:259-265 — before extracting anything, compare `agent/backtest/loaders/nobitex.py` and `agent/backtest/loaders/wallex.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) agent/cli/_legacy.py:4765 — agent/cli/_legacy.py:4765-4771 | agent/cli/_legacy.py:5285-5291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/cli/_legacy.py:4765` it does not close everything it opens, so those exact lines 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) agent/scripts/w4a_patch_blog.py:136 — agent/scripts/w4a_patch_blog.py:136-142 | agent/scripts/w4a_patch_blog.py:158-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `agent/scripts/w4a_patch_blog.py:164` calls `get` and `agent/scripts/w4a_patch_blog.py:142` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) agent/src/api/system_routes.py:299 — agent/src/api/system_routes.py:299-305 | agent/src/api/system_routes.py:338-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/api/system_routes.py:299` it does not close everything it opens, so those exact lines 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) REDACTED:277 — REDACTED:277-283 | REDACTED:326-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) agent/src/governance/ledger.py:346 — agent/src/governance/ledger.py:346-352 | agent/src/providers/openai_codex.py:144-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `handle` to `BinaryIO` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) agent/src/portfolio/normalization.py:39 — agent/src/portfolio/normalization.py:39-45 | agent/src/portfolio/service.py:148-154 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) agent/src/tools/etf_holdings_tool.py:707 — agent/src/tools/etf_holdings_tool.py:707-713 | agent/src/tools/institutional_holdings_tool.py:1642-1648 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) agent/src/tools/financial_statements_tool.py:462 — agent/src/tools/financial_statements_tool.py:462-468 | agent/src/tools/northbound_tool.py:50-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×10
  • Duplicated block (11 lines × 2) agent/backtest/engines/korea_equity.py:158 — agent/backtest/engines/korea_equity.py:158-168 | agent/backtest/engines/vietnam_equity.py:378-388 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) agent/cli/_legacy.py:6552 — agent/cli/_legacy.py:6552-6562 | agent/cli/_legacy.py:6642-6652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/cli/_legacy.py:6552` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) agent/src/agent/grounding/figures.py:836 — agent/src/agent/grounding/figures.py:836-846 | agent/src/agent/grounding/figures.py:852-862 — both copies are in the same file, so extract the block into 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) agent/src/channels/feishu.py:1461 — agent/src/channels/feishu.py:1461-1471 | agent/src/channels/feishu.py:1496-1506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/channels/feishu.py:1461` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) agent/src/entities/ingest.py:1083 — agent/src/entities/ingest.py:1083-1093 | agent/src/entities/ingest.py:1212-1224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/entities/ingest.py:1083` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) agent/src/tools/get_fundamentals_tool.py:145 — agent/src/tools/get_fundamentals_tool.py:145-155 | agent/src/tools/market_data_tool.py:172-182 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) agent/src/trading/connectors/binance/sdk.py:578 — agent/src/trading/connectors/binance/sdk.py:578-588 | agent/src/trading/connectors/upbit/sdk.py:420-430 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) agent/src/trading/service.py:232 — agent/src/trading/service.py:232-242 | agent/src/trading/service.py:280-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) agent/src/trading/service.py:527 — agent/src/trading/service.py:527-537 | agent/src/trading/service.py:617-627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/trading/service.py:527` it does not close everything it opens, so those exact lines 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) agent/src/skills/tushare/scripts/fund_data_example.py:21 — agent/src/skills/tushare/scripts/fund_data_example.py:21-31 | agent/src/skills/tushare/scripts/stock_data_example.py:21-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×9
  • Duplicated block (15 lines × 2) agent/backtest/engines/korea_equity.py:206 — agent/backtest/engines/korea_equity.py:206-220 | agent/backtest/engines/vietnam_equity.py:304-318 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) REDACTED:1312 — REDACTED:1312-1326 | REDACTED:1463-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.
  • Duplicated block (15 lines × 2) agent/src/factors/cli_handlers.py:452 — agent/src/factors/cli_handlers.py:452-466 | agent/src/factors/cli_handlers.py:523-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) agent/src/factors/zoo/gtja191/alpha_109.py:54 — agent/src/factors/zoo/gtja191/alpha_109.py:54-68 | agent/src/factors/zoo/gtja191/alpha_188.py:54-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) agent/src/factors/zoo/gtja191/alpha_172.py:54 — agent/src/factors/zoo/gtja191/alpha_172.py:54-68 | agent/src/factors/zoo/gtja191/alpha_186.py:54-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) agent/src/skills/elliott-wave/example_signal_engine.py:317 — agent/src/skills/elliott-wave/example_signal_engine.py:317-331 | agent/src/skills/elliott-wave/example_signal_engine.py:349-363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) agent/backtest/loaders/industry_loader.py:94 — agent/backtest/loaders/industry_loader.py:94-108 | agent/backtest/loaders/valuation_loader.py:83-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 2) agent/backtest/engines/korea_equity.py:81 — agent/backtest/engines/korea_equity.py:81-96 | agent/backtest/engines/vietnam_equity.py:94-108 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) agent/src/tools/lockup_expiry_tool.py:58 — agent/src/tools/lockup_expiry_tool.py:58-72 | agent/src/tools/stock_news_tool.py:58-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×8
  • Duplicated block (14 lines × 2) agent/backtest/loaders/nobitex.py:216 — agent/backtest/loaders/nobitex.py:216-229 | agent/backtest/loaders/wallex.py:215-228 — before extracting anything, compare `agent/backtest/loaders/nobitex.py` and `agent/backtest/loaders/wallex.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/nobitex.py:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) agent/cli/_legacy.py:3263 — agent/cli/_legacy.py:3263-3276 | agent/cli/_legacy.py:3280-3293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) agent/mcp_server.py:3046 — agent/mcp_server.py:3046-3059 | agent/mcp_server.py:3071-3086 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) agent/src/channels/mochat.py:551 — agent/src/channels/mochat.py:551-564 | agent/src/channels/mochat.py:585-598 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) agent/src/preflight.py:107 — agent/src/preflight.py:107-120 | agent/src/preflight.py:126-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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, `agent/src/preflight.py:122` calls `lower`, `get_claude_cli_auth_status` and `agent/src/preflight.py:141` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) agent/src/strategy_store/sqlite_store.py:428 — agent/src/strategy_store/sqlite_store.py:428-441 | agent/src/strategy_store/sqlite_store.py:602-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.
  • Duplicated block (14 lines × 2) agent/src/tools/get_fundamentals_tool.py:127 — agent/src/tools/get_fundamentals_tool.py:127-140 | agent/src/tools/market_data_tool.py:158-174 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) agent/src/trading/connectors/longbridge/sdk.py:530 — agent/src/trading/connectors/longbridge/sdk.py:530-543 | agent/src/trading/connectors/tiger/sdk.py:377-390 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×8
  • Duplicated block (12 lines × 2) agent/backtest/optimizers/max_diversification.py:37 — agent/backtest/optimizers/max_diversification.py:37-48 | agent/backtest/optimizers/mean_variance.py:53-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) agent/src/channels/telegram.py:74 — agent/src/channels/telegram.py:74-85 | agent/src/channels/utils.py:81-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) agent/src/factors/zoo/alpha101/alpha_009.py:76 — agent/src/factors/zoo/alpha101/alpha_009.py:76-87 | agent/src/factors/zoo/alpha101/alpha_010.py:76-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) agent/src/factors/zoo/alpha101/alpha_049.py:93 — agent/src/factors/zoo/alpha101/alpha_049.py:93-104 | agent/src/factors/zoo/alpha101/alpha_051.py:93-104 — before extracting anything, compare `agent/src/factors/zoo/alpha101/alpha_049.py` and `agent/src/factors/zoo/alpha101/alpha_051.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) agent/src/tools/trade_journal_parsers.py:496 — agent/src/tools/trade_journal_parsers.py:496-507 | agent/src/tools/trade_journal_parsers.py:510-521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) agent/src/factors/zoo/gtja191/alpha_134.py:54 — agent/src/factors/zoo/gtja191/alpha_134.py:54-65 | agent/src/factors/zoo/gtja191/alpha_178.py:54-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) agent/src/trading/connectors/mt5/orders.py:399 — agent/src/trading/connectors/mt5/orders.py:399-410 | agent/src/trading/connectors/okx/sdk.py:532-543 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `MT5Config` in one and `OKXConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) agent/src/factors/zoo/gtja191/alpha_103.py:38 — agent/src/factors/zoo/gtja191/alpha_103.py:38-49 | agent/src/factors/zoo/gtja191/alpha_177.py:38-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D30 · Dependency Vulnerabilities · Medium CVE · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×7
  • Duplicated block (6 lines × 3) agent/cli/_legacy.py:4764 — agent/cli/_legacy.py:4764-4769 | agent/cli/_legacy.py:4815-4820 | agent/cli/_legacy.py:5284-5289 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) agent/cli/ui/transcript.py:151 — agent/cli/ui/transcript.py:151-156 | agent/src/channels/feishu.py:1151-1156 | agent/src/channels/slack.py:762-767 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 3) agent/mcp_server.py:3054 — agent/mcp_server.py:3054-3059 | agent/mcp_server.py:3081-3086 | agent/mcp_server.py:3187-3192 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) agent/src/channels/config_meta.py:108 — agent/src/channels/config_meta.py:108-113 | agent/src/channels/config_meta.py:177-182 | agent/src/channels/config_meta.py:227-232 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) agent/src/factors/zoo/gtja191/alpha_049.py:49 — agent/src/factors/zoo/gtja191/alpha_049.py:49-54 | agent/src/factors/zoo/gtja191/alpha_050.py:49-54 | agent/src/factors/zoo/gtja191/alpha_051.py:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/factors/zoo/gtja191/alpha_049.py:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) agent/src/api/attribution_core.py:75 — agent/src/api/attribution_core.py:75-80 | agent/src/api/runs_routes.py:49-61 | agent/src/tools/report_audit_tool.py:331-345 — 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 (6 lines × 3) agent/src/trading/connectors/kis/sdk.py:909 — agent/src/trading/connectors/kis/sdk.py:909-914 | agent/src/trading/connectors/toss/sdk.py:569-574 | agent/src/trading/connectors/upbit/sdk.py:638-643 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `KISConfig` in one and `TossConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×6
  • Duplicated block (17 lines × 2) agent/src/memory/persistent.py:348 — agent/src/memory/persistent.py:348-364 | agent/src/memory/persistent.py:700-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17 lines × 2) agent/src/trading/connectors/futu/sdk.py:844 — agent/src/trading/connectors/futu/sdk.py:844-860 | agent/src/trading/connectors/futu/sdk.py:934-950 — both copies are in the same file, so extract the 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, `agent/src/trading/connectors/futu/sdk.py:932` calls `str`, `strip`, `upper` and `agent/src/trading/connectors/futu/sdk.py:842` 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 (17 lines × 2) agent/src/trading/connectors/kis/sdk.py:248 — agent/src/trading/connectors/kis/sdk.py:248-264 | agent/src/trading/connectors/toss/sdk.py:180-197 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `KISConfig | None = None` in one and `TossConfig | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 2) agent/src/trading/connectors/okx/sdk.py:794 — agent/src/trading/connectors/okx/sdk.py:794-810 | agent/src/trading/connectors/tiger/sdk.py:727-743 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) agent/backtest/engines/korea_equity.py:299 — agent/backtest/engines/korea_equity.py:299-316 | agent/backtest/engines/vietnam_equity.py:489-505 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) agent/src/tools/block_trades_tool.py:76 — agent/src/tools/block_trades_tool.py:76-92 | agent/src/tools/northbound_tool.py:183-199 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×5
  • Animation without a prefers-reduced-motion guard desktop/electron/src/loading.html:20 — `.bar` moves (`animation: loading 1.25s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard frontend/src/components/chat/SwarmStatusCard.tsx:42 — <div> moves — its `animate-[pulse-slide_2s_ease-in-out_infinite]` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard wiki/alpha-library/index.html:42 — `.alpha-zoo-card` moves (`transition: border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard wiki/styles.css:498 — `.knowledge-card` moves (`transition: border-color 160ms ease, transform 160ms ease, background 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard frontend/src/index.css:185 — `.pixel-character__typing` moves (`animation: pixel-typing 900ms steps(2, end) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) agent/src/skills/okx-market/scripts/candle_data_example.py:18 — agent/src/skills/okx-market/scripts/candle_data_example.py:18-35 | agent/src/skills/okx-market/scripts/candle_data_example.py:49-66 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (18 lines × 2) agent/src/tools/autopilot_tool.py:101 — agent/src/tools/autopilot_tool.py:101-118 | agent/src/tools/autopilot_tool.py:301-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) agent/src/tools/skill_writer_tool.py:356 — agent/src/tools/skill_writer_tool.py:356-373 | agent/src/tools/skill_writer_tool.py:392-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) agent/src/trading/connectors/mt5/orders.py:89 — agent/src/trading/connectors/mt5/orders.py:89-106 | agent/src/trading/connectors/okx/sdk.py:411-428 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (18 lines × 2) agent/cli/commands/research_playbook.py:673 — agent/cli/commands/research_playbook.py:673-690 | agent/cli/commands/strategy_evidence.py:177-194 — 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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×5
  • Duplicated block (15 lines × 2 locations) frontend/src/pages/Agent.tsx:1095 — frontend/src/pages/Agent.tsx:1095 · frontend/src/pages/Agent.tsx:1133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2 locations) frontend/src/pages/Reports.tsx:161 — frontend/src/pages/Reports.tsx:161 · frontend/src/pages/Runtime.tsx:113 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
  • Duplicated block (15 lines × 2 locations) frontend/src/pages/Runtime.tsx:516 — frontend/src/pages/Runtime.tsx:516 · frontend/src/pages/Scheduled.tsx:76 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (15 lines × 2 locations) frontend/src/pages/Settings.tsx:250 — frontend/src/pages/Settings.tsx:250 · frontend/src/pages/Settings.tsx:294 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) frontend/src/pages/Settings.tsx:608 — frontend/src/pages/Settings.tsx:608 · frontend/src/pages/Settings.tsx:710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (12 lines × 2 locations) · ×5
  • Duplicated block (12 lines × 2 locations) frontend/src/components/charts/CandlestickChart.tsx:213 — frontend/src/components/charts/CandlestickChart.tsx:213 · frontend/src/pages/Compare.tsx:151 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) frontend/src/components/charts/FactorResearchPanel.tsx:18 — frontend/src/components/charts/FactorResearchPanel.tsx:18 · frontend/src/components/charts/StrategyResearchDashboard.tsx:18 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) frontend/src/components/charts/MonteCarloPathsChart.tsx:124 — frontend/src/components/charts/MonteCarloPathsChart.tsx:124 · frontend/src/components/charts/WalkForwardChart.tsx:92 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) frontend/src/lib/chart-theme.ts:5 — frontend/src/lib/chart-theme.ts:5 · frontend/src/lib/pnl-colors.ts:14 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (12 lines × 2 locations) frontend/src/pages/Settings.tsx:81 — frontend/src/pages/Settings.tsx:81 · frontend/src/pages/Settings.tsx:95 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
AC2 · Forms & labels · <fieldset> without a <legend> · ×4
  • <fieldset> without a <legend> frontend/src/components/chat/RunnerBudgetControls.tsx:48 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
  • <fieldset> without a <legend> frontend/src/components/portfolio/ConnectionCenter.tsx:228 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
  • <fieldset> without a <legend> frontend/src/pages/PixelOffice.tsx:86 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
  • <fieldset> without a <legend> frontend/src/pages/PixelOffice.tsx:105 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · ClassTooLong · ×4
  • ClassTooLong: Scheduled frontend/src/pages/Scheduled.tsx:1 — ClassTooLong — 643 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 243 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Settings frontend/src/pages/Settings.tsx:1 — ClassTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 202 over it, 1.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PaperTrading frontend/src/pages/PaperTrading.tsx:1 — ClassTooLong — 488 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 88 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChannelConfigPanel frontend/src/components/settings/ChannelConfigPanel.tsx:1 — ClassTooLong — 477 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 77 over it, 1.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/sumd10.py:27 — agent/src/factors/zoo/qlib158/sumd10.py:27-36 | agent/src/factors/zoo/qlib158/sumd20.py:27-36 | agent/src/factors/zoo/qlib158/sumd30.py:27-36 | agent/src/factors/zoo/qlib158/sumd5.py:27-36 | agent/src/factors/zoo/qlib158/sumd60.py:27-36 | agent/src/factors/zoo/qlib158/vsumd10.py:27-36 | agent/src/factors/zoo/qlib158/vsumd20.py:27-36 | agent/src/factors/zoo/qlib158/vsumd30.py:27-36 | agent/src/factors/zoo/qlib158/vsumd5.py:27-36 | agent/src/factors/zoo/qlib158/vsumd60.py:27-36 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
  • Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/sumn10.py:27 — agent/src/factors/zoo/qlib158/sumn10.py:27-34 | agent/src/factors/zoo/qlib158/sumn20.py:27-34 | agent/src/factors/zoo/qlib158/sumn30.py:27-34 | agent/src/factors/zoo/qlib158/sumn5.py:27-34 | agent/src/factors/zoo/qlib158/sumn60.py:27-34 | agent/src/factors/zoo/qlib158/vsumn10.py:27-34 | agent/src/factors/zoo/qlib158/vsumn20.py:27-34 | agent/src/factors/zoo/qlib158/vsumn30.py:27-34 | agent/src/factors/zoo/qlib158/vsumn5.py:27-34 | agent/src/factors/zoo/qlib158/vsumn60.py:27-34 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
  • Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/sump10.py:27 — agent/src/factors/zoo/qlib158/sump10.py:27-34 | agent/src/factors/zoo/qlib158/sump20.py:27-34 | agent/src/factors/zoo/qlib158/sump30.py:27-34 | agent/src/factors/zoo/qlib158/sump5.py:27-34 | agent/src/factors/zoo/qlib158/sump60.py:27-34 | agent/src/factors/zoo/qlib158/vsump10.py:27-34 | agent/src/factors/zoo/qlib158/vsump20.py:27-34 | agent/src/factors/zoo/qlib158/vsump30.py:27-34 | agent/src/factors/zoo/qlib158/vsump5.py:27-34 | agent/src/factors/zoo/qlib158/vsump60.py:27-34 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
  • Members sharing a duplicated core (10 members, 50+ identical tokens) agent/src/trading/connectors/alpaca/sdk.py:175 — agent/src/trading/connectors/alpaca/sdk.py:175-183 | agent/src/trading/connectors/binance/sdk.py:198-206 | agent/src/trading/connectors/etoro/client.py:169-177 | agent/src/trading/connectors/futu/sdk.py:215-223 | agent/src/trading/connectors/ibkr/local.py:161-176 | REDACTED:164-172 | agent/src/trading/connectors/okx/sdk.py:168-176 | agent/src/trading/connectors/tiger/sdk.py:168-176 | agent/src/trading/connectors/toss/sdk.py:168-176 | agent/src/trading/connectors/trading212/sdk.py:151-159 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/factors/zoo/alpha101/alpha_071.py:56 — agent/src/factors/zoo/alpha101/alpha_071.py:56-75 | agent/src/factors/zoo/alpha101/alpha_073.py:56-75 | agent/src/factors/zoo/alpha101/alpha_076.py:87-105 | agent/src/factors/zoo/alpha101/alpha_087.py:87-105 | agent/src/factors/zoo/alpha101/alpha_096.py:56-73 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/cntd10.py:27 — agent/src/factors/zoo/qlib158/cntd10.py:27-34 | agent/src/factors/zoo/qlib158/cntd20.py:27-34 | agent/src/factors/zoo/qlib158/cntd30.py:27-34 | agent/src/factors/zoo/qlib158/cntd5.py:27-34 | agent/src/factors/zoo/qlib158/cntd60.py:27-34 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/factors/zoo/qlib158/rsqr10.py:28 — agent/src/factors/zoo/qlib158/rsqr10.py:28-33 | agent/src/factors/zoo/qlib158/rsqr20.py:28-33 | agent/src/factors/zoo/qlib158/rsqr30.py:28-33 | agent/src/factors/zoo/qlib158/rsqr5.py:28-33 | agent/src/factors/zoo/qlib158/rsqr60.py:28-33 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) agent/src/trading/connectors/dhan/sdk.py:171 — agent/src/trading/connectors/dhan/sdk.py:171-181 | agent/src/trading/connectors/kis/sdk.py:229-239 | agent/src/trading/connectors/shoonya/sdk.py:171-181 | agent/src/trading/connectors/upbit/sdk.py:165-175 | agent/src/trading/connectors/zerodha/sdk.py:165-175 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (4 members, 50+ identical tokens) agent/cli/_legacy.py:4737 — agent/cli/_legacy.py:4737-4781 | agent/cli/_legacy.py:4812-4831 | agent/cli/_legacy.py:5192-5228 | agent/cli/_legacy.py:5249-5300 — 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) agent/cli/commands/goal.py:155 — agent/cli/commands/goal.py:155-165 | agent/cli/commands/goal.py:220-262 | agent/cli/commands/goal.py:266-294 | agent/cli/commands/goal.py:298-354 — 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) agent/src/trading/connectors/alpaca/sdk.py:472 — agent/src/trading/connectors/alpaca/sdk.py:472-619 | agent/src/trading/connectors/binance/sdk.py:538-657 | agent/src/trading/connectors/kis/sdk.py:481-559 | agent/src/trading/connectors/upbit/sdk.py:387-494 — 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) agent/src/trading/connectors/dhan/sdk.py:532 — agent/src/trading/connectors/dhan/sdk.py:532-565 | agent/src/trading/connectors/shoonya/sdk.py:510-538 | agent/src/trading/connectors/upbit/sdk.py:503-536 | agent/src/trading/connectors/zerodha/sdk.py:627-659 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×4
  • Duplicated block (13 lines × 2) REDACTED:115 — REDACTED:115-127 | agent/src/channels/telegram.py:206-218 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) agent/src/factors/zoo/gtja191/alpha_161.py:54 — agent/src/factors/zoo/gtja191/alpha_161.py:54-66 | agent/src/factors/zoo/gtja191/alpha_175.py:54-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) agent/src/live/enforcement.py:270 — agent/src/live/enforcement.py:270-282 | agent/src/live/enforcement.py:761-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. The matched lines also transfer control out of the body holding them, 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) agent/src/factors/zoo/gtja191/alpha_165.py:54 — agent/src/factors/zoo/gtja191/alpha_165.py:54-66 | agent/src/factors/zoo/gtja191/alpha_183.py:54-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×4
  • Duplicated block (7 lines × 3) agent/src/factors/zoo/gtja191/alpha_047.py:49 — agent/src/factors/zoo/gtja191/alpha_047.py:49-55 | agent/src/factors/zoo/gtja191/alpha_072.py:49-55 | agent/src/factors/zoo/gtja191/alpha_082.py:49-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 3) agent/src/tools/get_fundamentals_tool.py:137 — agent/src/tools/get_fundamentals_tool.py:137-143 | agent/src/tools/get_fundamentals_tool.py:144-150 | agent/src/tools/market_data_tool.py:171-177 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) agent/backtest/loaders/mt5_loader.py:127 — agent/backtest/loaders/mt5_loader.py:127-133 | agent/backtest/loaders/tickerall_loader.py:137-143 | agent/src/trading/connectors/mt5/symbols.py:30-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 3) agent/cli/commands/chat.py:238 — agent/cli/commands/chat.py:238-244 | agent/cli/commands/session.py:89-95 | agent/cli/commands/show.py:77-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `command` to `str = "model"` in one and `str = "history"` 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.
X2 · Cancellation propagation · Async function without AbortSignal · ×4
  • Async function without AbortSignal: loadZh wiki/site.js:49 — `loadZh` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: getPypi wiki/functions/api/stats.js:13 — `getPypi` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: withAuthTicket frontend/src/lib/apiAuth.ts:36 — `withAuthTicket` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: requestJson frontend/src/components/settings/QVerisSettings.tsx:49 — `requestJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
AC3 · Page structure · Heading level jumps from h1 to h3 · ×3
  • Heading level jumps from h1 to h3 frontend/src/pages/AlphaZoo.tsx:243 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
  • Heading level jumps from h1 to h3 wiki/alpha-library/index.html:121 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
  • Heading level jumps from h1 to h3 wiki/tutorials/index.html:66 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC4 · Keyboard semantics · Modal dialog does not manage focus · ×3
  • Modal dialog does not manage focus frontend/src/components/chat/PineScriptViewer.tsx:51 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus frontend/src/components/portfolio/ConnectionCenter.tsx:133 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus frontend/src/components/portfolio/PortfolioSourceEditor.tsx:96 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
D17 · Explicit Debt · TodoComment · ×3
  • TodoComment agent/src/skills/strategy-dev-manager/templates/factor_signal_engine.py:47 — # TODO: Replace with actual factor formula from paper — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment agent/src/skills/strategy-dev-manager/templates/strategy_signal_engine.py:53 — # TODO: Replace with actual strategy logic from paper — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment agent/src/live/enforcement.py:353 — # TODO(L6): pin the exact Robinhood positions envelope key once the real — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) agent/mcp_server.py:877 — agent/mcp_server.py:877-937 | agent/src/trading/connectors/binance/sdk.py:124-138 | agent/src/trading/connectors/futu/sdk.py:144-158 | agent/src/trading/connectors/kis/sdk.py:163-175 | agent/src/trading/connectors/okx/sdk.py:105-119 | agent/src/trading/connectors/toss/sdk.py:114-126 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) agent/src/skills/candlestick/example_signal_engine.py:536 — agent/src/skills/candlestick/example_signal_engine.py:536-563 | agent/src/skills/elliott-wave/example_signal_engine.py:414-444 | agent/src/skills/harmonic/example_signal_engine.py:431-461 | agent/src/skills/ichimoku/example_signal_engine.py:135-165 | agent/src/skills/smc/example_signal_engine.py:26-53 | agent/src/skills/technical-basic/example_signal_engine.py:250-277 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) agent/src/trading/service.py:503 — agent/src/trading/service.py:503-514 | agent/src/trading/service.py:524-539 | agent/src/trading/service.py:543-554 | agent/src/trading/service.py:565-581 | agent/src/trading/service.py:589-603 | agent/src/trading/service.py:614-630 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) agent/backtest/runner.py:1142 — agent/backtest/runner.py:1142-1163 | agent/backtest/runner.py:1221-1242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/runner.py:1142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) agent/src/quantlib/impact.py:184 — agent/src/quantlib/impact.py:184-205 | agent/src/quantlib/impact.py:217-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) agent/backtest/engines/korea_equity.py:274 — agent/backtest/engines/korea_equity.py:274-296 | agent/backtest/engines/vietnam_equity.py:465-486 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×3
  • Duplicated block (16 lines × 2) agent/src/tools/pattern_tool.py:236 — agent/src/tools/pattern_tool.py:236-251 | agent/src/tools/pattern_tool.py:271-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/tools/pattern_tool.py:236` it does not close everything it opens, so those exact lines 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) agent/src/trading/connectors/dhan/sdk.py:295 — agent/src/trading/connectors/dhan/sdk.py:295-310 | agent/src/trading/connectors/shoonya/sdk.py:291-306 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) agent/src/trading/connectors/toss/sdk.py:408 — agent/src/trading/connectors/toss/sdk.py:408-423 | agent/src/trading/connectors/trading212/sdk.py:361-376 — `agent/src/trading/connectors/toss/sdk.py` and `agent/src/trading/connectors/trading212/sdk.py` 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 6 separate duplicated blocks between them, totalling at least 61 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `TossConfig | None = None` in one and `Trading212Config | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×3
  • Duplicated block (13–14 lines × 2) agent/backtest/engines/china_a.py:87 — agent/backtest/engines/china_a.py:87-100 | agent/backtest/engines/india_equity.py:113-125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) agent/cli/onboard.py:309 — agent/cli/onboard.py:309-322 | agent/cli/onboard.py:348-360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/cli/onboard.py:309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) agent/src/agent/tool_lifecycle.py:464 — agent/src/agent/tool_lifecycle.py:464-476 | agent/src/agent/tool_lifecycle.py:518-531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) agent/scripts/w4a_run_benches.py:82 — agent/scripts/w4a_run_benches.py:82-94 | agent/scripts/w4a_run_benches.py:99-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/scripts/w4a_run_benches.py:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) agent/src/quantlib/fundmath.py:1547 — agent/src/quantlib/fundmath.py:1547-1558 | agent/src/quantlib/fundmath.py:1702-1714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/fundmath.py:1702` it begins part-way through the construct above it, so those 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, `agent/src/quantlib/fundmath.py:1546` calls `tuple`, `filter` and `agent/src/quantlib/fundmath.py:1702` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 2) agent/src/trading/connectors/shoonya/sdk.py:467 — agent/src/trading/connectors/shoonya/sdk.py:467-479 | agent/src/trading/connectors/zerodha/sdk.py:591-602 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) agent/cli/_legacy.py:5136 — agent/cli/_legacy.py:5136-5147 | agent/cli/_legacy.py:5201-5212 | agent/cli/_legacy.py:5264-5275 — 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 `agent/cli/_legacy.py:5136` it begins part-way through the construct above it, so those 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, `agent/cli/_legacy.py:5279` calls `isinstance` and `agent/cli/_legacy.py:5149` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) agent/src/trading/connectors/alpaca/sdk.py:537 — agent/src/trading/connectors/alpaca/sdk.py:537-548 | agent/src/trading/connectors/longbridge/sdk.py:548-559 | agent/src/trading/connectors/tiger/sdk.py:394-405 — 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 (12 lines × 3) agent/backtest/rebalance_notes.py:191 — agent/backtest/rebalance_notes.py:191-204 | agent/backtest/risk_xray.py:384-395 | agent/backtest/validation.py:504-520 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×3
  • Duplicated block (10–11 lines × 2) agent/backtest/loaders/ccxt_loader.py:98 — agent/backtest/loaders/ccxt_loader.py:98-108 | agent/backtest/loaders/okx.py:81-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10–11 lines × 2) agent/cli/_legacy.py:4960 — agent/cli/_legacy.py:4960-4970 | agent/cli/_legacy.py:5060-5069 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) agent/src/ui_services.py:165 — agent/src/ui_services.py:165-175 | agent/src/ui_services.py:178-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 10) · ×3
  • Duplicated block (6 lines × 10) agent/src/factors/zoo/qlib158/sumd10.py:27 — agent/src/factors/zoo/qlib158/sumd10.py:27-32 | agent/src/factors/zoo/qlib158/sumd20.py:27-32 | agent/src/factors/zoo/qlib158/sumd30.py:27-32 | agent/src/factors/zoo/qlib158/sumd5.py:27-32 | agent/src/factors/zoo/qlib158/sumd60.py:27-32 | agent/src/factors/zoo/qlib158/vsumd10.py:27-32 | agent/src/factors/zoo/qlib158/vsumd20.py:27-32 | agent/src/factors/zoo/qlib158/vsumd30.py:27-32 | agent/src/factors/zoo/qlib158/vsumd5.py:27-32 | agent/src/factors/zoo/qlib158/vsumd60.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 10 call sites, so a change lands once.
  • Duplicated block (6 lines × 10) agent/src/factors/zoo/qlib158/sumn10.py:27 — agent/src/factors/zoo/qlib158/sumn10.py:27-32 | agent/src/factors/zoo/qlib158/sumn20.py:27-32 | agent/src/factors/zoo/qlib158/sumn30.py:27-32 | agent/src/factors/zoo/qlib158/sumn5.py:27-32 | agent/src/factors/zoo/qlib158/sumn60.py:27-32 | agent/src/factors/zoo/qlib158/vsumn10.py:27-32 | agent/src/factors/zoo/qlib158/vsumn20.py:27-32 | agent/src/factors/zoo/qlib158/vsumn30.py:27-32 | agent/src/factors/zoo/qlib158/vsumn5.py:27-32 | agent/src/factors/zoo/qlib158/vsumn60.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 10 call sites, so a change lands once.
  • Duplicated block (6 lines × 10) agent/src/factors/zoo/qlib158/sump10.py:27 — agent/src/factors/zoo/qlib158/sump10.py:27-32 | agent/src/factors/zoo/qlib158/sump20.py:27-32 | agent/src/factors/zoo/qlib158/sump30.py:27-32 | agent/src/factors/zoo/qlib158/sump5.py:27-32 | agent/src/factors/zoo/qlib158/sump60.py:27-32 | agent/src/factors/zoo/qlib158/vsump10.py:27-32 | agent/src/factors/zoo/qlib158/vsump20.py:27-32 | agent/src/factors/zoo/qlib158/vsump30.py:27-32 | agent/src/factors/zoo/qlib158/vsump5.py:27-32 | agent/src/factors/zoo/qlib158/vsump60.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 10 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) agent/src/api/sessions_routes.py:551 — agent/src/api/sessions_routes.py:551-555 | agent/src/api/sessions_routes.py:598-603 | agent/src/api/sessions_routes.py:700-705 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/api/sessions_routes.py:597` calls `HTTPException`, `str` and `agent/src/api/sessions_routes.py:550` 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 × 3) agent/src/factors/zoo/gtja191/alpha_043.py:50 — agent/src/factors/zoo/gtja191/alpha_043.py:50-54 | agent/src/factors/zoo/gtja191/alpha_084.py:50-54 | agent/src/factors/zoo/gtja191/alpha_094.py:50-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (5 lines × 3) agent/src/factors/zoo/gtja191/alpha_049.py:55 — agent/src/factors/zoo/gtja191/alpha_049.py:55-59 | agent/src/factors/zoo/gtja191/alpha_050.py:55-59 | agent/src/factors/zoo/gtja191/alpha_051.py:55-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/factors/zoo/gtja191/alpha_049.py:55` it begins part-way through the construct above it, so those 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) · ×3
  • Duplicated block (5 lines × 5) agent/src/factors/zoo/qlib158/cntn10.py:27 — agent/src/factors/zoo/qlib158/cntn10.py:27-31 | agent/src/factors/zoo/qlib158/cntn20.py:27-31 | agent/src/factors/zoo/qlib158/cntn30.py:27-31 | agent/src/factors/zoo/qlib158/cntn5.py:27-31 | agent/src/factors/zoo/qlib158/cntn60.py:27-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 5) agent/src/factors/zoo/qlib158/cntp10.py:27 — agent/src/factors/zoo/qlib158/cntp10.py:27-31 | agent/src/factors/zoo/qlib158/cntp20.py:27-31 | agent/src/factors/zoo/qlib158/cntp30.py:27-31 | agent/src/factors/zoo/qlib158/cntp5.py:27-31 | agent/src/factors/zoo/qlib158/cntp60.py:27-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 5) agent/src/factors/zoo/qlib158/corr10.py:28 — agent/src/factors/zoo/qlib158/corr10.py:28-32 | agent/src/factors/zoo/qlib158/corr20.py:28-32 | agent/src/factors/zoo/qlib158/corr30.py:28-32 | agent/src/factors/zoo/qlib158/corr5.py:28-32 | agent/src/factors/zoo/qlib158/corr60.py:28-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×3
  • Sync-over-async blocking agent/src/channels/feishu.py:713 — `start` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking desktop/electron/src/backend-manager.ts:94 — `mkdirSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking desktop/electron/src/backend-manager.ts:124 — `existsSync` in `start` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×3
  • Duplicated block (14 lines × 2 locations) frontend/src/components/charts/AttributionCumulativeChart.tsx:24 — frontend/src/components/charts/AttributionCumulativeChart.tsx:24 · frontend/src/components/charts/RollingBetaAlphaChart.tsx:23 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) frontend/src/components/charts/CandlestickChart.tsx:94 — frontend/src/components/charts/CandlestickChart.tsx:94 · frontend/src/components/charts/MiniEquityChart.tsx:38 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) frontend/src/pages/Agent.tsx:1077 — frontend/src/pages/Agent.tsx:1077 · frontend/src/pages/Agent.tsx:1116 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (13 matched lines × 2 locations) · ×3
  • Duplicated block with local edits (13 matched lines × 2 locations) frontend/src/components/charts/EquityChart.tsx:32 — frontend/src/components/charts/EquityChart.tsx:32 · frontend/src/components/charts/RegimeTimeline.tsx:39 — the two spans are one implementation copied and then locally edited — 84 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (13 matched lines × 2 locations) frontend/src/components/chat/Composer.tsx:236 — frontend/src/components/chat/Composer.tsx:236 · frontend/src/components/layout/Layout.tsx:40 — the two spans are one implementation copied and then locally edited — 77 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (13 matched lines × 2 locations) frontend/src/components/chat/Composer.tsx:236 — frontend/src/components/chat/Composer.tsx:236 · frontend/src/components/layout/SidebarNavigation.tsx:15 — the two spans are one implementation copied and then locally edited — 78 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×3
  • Duplicated block (13 lines × 2 locations) frontend/src/components/charts/FactorResearchPanel.tsx:193 — frontend/src/components/charts/FactorResearchPanel.tsx:193 · frontend/src/components/charts/StrategyResearchDashboard.tsx:196 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) frontend/src/pages/Agent.tsx:1522 — frontend/src/pages/Agent.tsx:1522 · frontend/src/pages/Agent.tsx:1627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2 locations) frontend/src/pages/AlphaZoo.tsx:667 — frontend/src/pages/AlphaZoo.tsx:667 · frontend/src/pages/AlphaZoo.tsx:1048 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (11 lines × 2 locations) · ×3
  • Duplicated block (11 lines × 2 locations) desktop/electron/src/backend-manager.ts:480 — desktop/electron/src/backend-manager.ts:480 · desktop/electron/src/backend-watchdog.ts:128 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (11 lines × 2 locations) frontend/src/components/charts/MonteCarloPathsChart.tsx:9 — frontend/src/components/charts/MonteCarloPathsChart.tsx:9 · frontend/src/components/charts/RegimeTimeline.tsx:8 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (11 lines × 2 locations) frontend/src/components/charts/ValidationPanel.tsx:68 — frontend/src/components/charts/ValidationPanel.tsx:68 · frontend/src/components/charts/ValidationPanel.tsx:117 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
AC3 · Page structure · Data table has no header cells · ×2
  • Data table has no header cells frontend/src/components/charts/StrategyResearchDashboard.tsx:287 — A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
  • Data table has no header cells frontend/src/components/run/RunCard.tsx:55 — A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
AC6 · Visual & motion safety · Focus outline removed inline · ×2
  • Focus outline removed inline frontend/src/components/chat/Composer.tsx:420 — <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline frontend/src/pages/Reports.tsx:112 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 30) · ×2
  • sdk.place_order (cyclomatic 30) agent/src/trading/connectors/alpaca/sdk.py:460 — sdk.place_order has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • sdk.place_order (cyclomatic 30) agent/src/trading/connectors/tiger/sdk.py:335 — sdk.place_order has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Settings.Settings · ×2
  • Settings.Settings::submitDataSources (cyclomatic 20) frontend/src/pages/Settings.tsx:265 — Settings.Settings::submitDataSources has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Settings.Settings, Settings.Settings::submit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Settings.Settings::submit (cyclomatic 17) frontend/src/pages/Settings.tsx:227 — Settings.Settings::submit has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Settings.Settings, Settings.Settings::submitDataSources) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Settings.Settings · ×2
  • Settings.Settings::submitDataSources (cognitive 22) frontend/src/pages/Settings.tsx:265 — Settings.Settings::submitDataSources has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 8, if/else 3, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 2 other methods here (Settings.Settings, Settings.Settings::submit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • Settings.Settings::submit (cognitive 16) frontend/src/pages/Settings.tsx:227 — Settings.Settings::submit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 5, if/else 3, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 2 other methods here (Settings.Settings, Settings.Settings::submitDataSources) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) agent/src/channels/config_meta.py:74 — agent/src/channels/config_meta.py:74-93 | agent/src/channels/config_meta.py:97-128 | agent/src/channels/config_meta.py:132-152 | agent/src/channels/config_meta.py:156-208 | agent/src/channels/config_meta.py:212-247 | agent/src/channels/config_meta.py:259-309 | agent/src/channels/config_meta.py:322-371 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) agent/src/trading/connectors/binance/sdk.py:219 — agent/src/trading/connectors/binance/sdk.py:219-267 | agent/src/trading/connectors/dhan/sdk.py:198-230 | agent/src/trading/connectors/mt5/reads.py:67-103 | agent/src/trading/connectors/okx/sdk.py:189-247 | agent/src/trading/connectors/shoonya/sdk.py:198-223 | agent/src/trading/connectors/tiger/sdk.py:189-232 | agent/src/trading/connectors/upbit/sdk.py:192-221 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) agent/src/tools/trade_journal_tool.py:147 — agent/src/tools/trade_journal_tool.py:147-177 | agent/src/tools/trade_journal_tool.py:199-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) agent/backtest/engines/china_futures.py:202 — agent/backtest/engines/china_futures.py:202-232 | agent/backtest/engines/global_futures.py:236-267 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) agent/src/api/alpha_routes.py:623 — agent/src/api/alpha_routes.py:623-645 | agent/src/api/alpha_routes.py:719-741 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) agent/src/tools/autopilot_tool.py:461 — agent/src/tools/autopilot_tool.py:461-483 | agent/src/tools/autopilot_tool.py:580-602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) agent/src/providers/llm.py:1422 — agent/src/providers/llm.py:1422-1441 | agent/src/providers/llm.py:1446-1464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/providers/llm.py:1446` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–20 lines × 2) agent/src/quantlib/fundmath.py:1528 — agent/src/quantlib/fundmath.py:1528-1546 | agent/src/quantlib/fundmath.py:1678-1697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/fundmath.py:1678` it begins part-way through the construct above it, so those 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, `agent/src/quantlib/fundmath.py:1699` calls `ValueError` and `agent/src/quantlib/fundmath.py:1547` 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 (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) agent/src/skills/candlestick/example_signal_engine.py:347 — agent/src/skills/candlestick/example_signal_engine.py:347-365 | agent/src/skills/candlestick/example_signal_engine.py:381-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) agent/src/strategy_store/sqlite_store.py:409 — agent/src/strategy_store/sqlite_store.py:409-427 | agent/src/strategy_store/sqlite_store.py:584-602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) agent/src/api/runs_routes.py:918 — agent/src/api/runs_routes.py:918-934 | agent/src/api/runs_routes.py:937-954 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) agent/src/tools/skill_writer_tool.py:111 — agent/src/tools/skill_writer_tool.py:111-127 | agent/src/tools/skill_writer_tool.py:180-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–15 lines × 2) · ×2
  • Duplicated block (10–15 lines × 2) agent/backtest/correlation.py:208 — agent/backtest/correlation.py:208-222 | agent/backtest/regime.py:118-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–15 lines × 2) agent/src/live/order_guard.py:276 — agent/src/live/order_guard.py:276-290 | agent/src/live/sdk_order_gate.py:911-920 — 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 `agent/src/live/order_guard.py:276` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) agent/src/api/security.py:440 — agent/src/api/security.py:440-451 | agent/src/api/security.py:646-659 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–14 lines × 2) agent/src/channels/discord.py:532 — agent/src/channels/discord.py:532-545 | agent/src/channels/telegram.py:1046-1057 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) agent/src/api/attribution_routes.py:55 — agent/src/api/attribution_routes.py:55-67 | agent/src/api/runs_routes.py:853-865 | agent/src/api/scheduled_routes.py:458-470 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (13 lines × 3) REDACTED:1021 — REDACTED:1021-1033 | REDACTED:1048-1060 | REDACTED:1138-1150 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) agent/cli/_legacy.py:5220 — agent/cli/_legacy.py:5220-5228 | agent/cli/_legacy.py:5291-5300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9–10 lines × 2) agent/src/quantlib/performance.py:327 — agent/src/quantlib/performance.py:327-336 | agent/src/quantlib/performance.py:862-870 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/performance.py:327` it does not close everything it opens, so those 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 × 3) · ×2
  • Duplicated block (9 lines × 3) agent/src/goal/store.py:117 — agent/src/goal/store.py:117-125 | agent/src/research_artifacts/store.py:73-81 | agent/src/strategy_store/sqlite_store.py:145-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `db_path` to `Path | None = None` in one and `Path | str | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 3) agent/src/trading/connectors/dhan/sdk.py:116 — agent/src/trading/connectors/dhan/sdk.py:116-124 | agent/src/trading/connectors/etoro/client.py:100-108 | agent/src/trading/connectors/upbit/sdk.py:110-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) agent/src/trading/connectors/alpaca/sdk.py:501 — agent/src/trading/connectors/alpaca/sdk.py:501-508 | agent/src/trading/connectors/kis/sdk.py:503-510 | agent/src/trading/connectors/upbit/sdk.py:416-423 — 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 (8 lines × 3) agent/src/goal/store.py:96 — agent/src/goal/store.py:96-103 | agent/src/strategy_store/sqlite_store.py:111-118 | agent/src/strategy_store/store.py:53-60 — 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 (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) agent/src/channels/config_meta.py:77 — agent/src/channels/config_meta.py:77-82 | agent/src/channels/config_meta.py:135-140 | agent/src/channels/config_meta.py:283-288 | agent/src/channels/config_meta.py:344-349 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) agent/src/tools/fred_macro_tool.py:255 — agent/src/tools/fred_macro_tool.py:255-260 | agent/src/tools/research_reports_tool.py:229-234 | agent/src/tools/sec_filings_tool.py:177-182 | agent/src/tools/symbol_search_tool.py:402-407 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) agent/src/factors/zoo/qlib158/cord10.py:28 — agent/src/factors/zoo/qlib158/cord10.py:28-34 | agent/src/factors/zoo/qlib158/cord20.py:28-34 | agent/src/factors/zoo/qlib158/cord30.py:28-34 | agent/src/factors/zoo/qlib158/cord5.py:28-34 | agent/src/factors/zoo/qlib158/cord60.py:28-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 5) agent/src/factors/zoo/qlib158/rsv10.py:27 — agent/src/factors/zoo/qlib158/rsv10.py:27-33 | agent/src/factors/zoo/qlib158/rsv20.py:27-33 | agent/src/factors/zoo/qlib158/rsv30.py:27-33 | agent/src/factors/zoo/qlib158/rsv5.py:27-33 | agent/src/factors/zoo/qlib158/rsv60.py:27-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) agent/src/factors/zoo/qlib158/wvma10.py:27 — agent/src/factors/zoo/qlib158/wvma10.py:27-32 | agent/src/factors/zoo/qlib158/wvma20.py:27-32 | agent/src/factors/zoo/qlib158/wvma30.py:27-32 | agent/src/factors/zoo/qlib158/wvma5.py:27-32 | agent/src/factors/zoo/qlib158/wvma60.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 5) agent/src/factors/zoo/qlib158/rsqr10.py:28 — agent/src/factors/zoo/qlib158/rsqr10.py:28-33 | agent/src/factors/zoo/qlib158/rsqr20.py:28-33 | agent/src/factors/zoo/qlib158/rsqr30.py:28-33 | agent/src/factors/zoo/qlib158/rsqr5.py:28-33 | agent/src/factors/zoo/qlib158/rsqr60.py:28-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D6 · Cohesion (LCOM4) · Low cohesion · ×2
  • Low cohesion: BrazilEquityEngine (LCOM4 4) agent/backtest/engines/brazil_equity.py:42 — BrazilEquityEngine'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: VolGatedStrangleEngine (LCOM4 4) agent/src/skills/options-strategy/example_signal_engine.py:213 — VolGatedStrangleEngine'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.
R10 · Code Duplication · Duplicated block (25 lines × 2 locations) · ×2
  • Duplicated block (25 lines × 2 locations) frontend/src/pages/Compare.tsx:258 — frontend/src/pages/Compare.tsx:258 · frontend/src/pages/Compare.tsx:289 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (25 lines × 2 locations) frontend/src/pages/PaperTrading.tsx:295 — frontend/src/pages/PaperTrading.tsx:295 · frontend/src/pages/PaperTrading.tsx:426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×2
  • Duplicated block (19 lines × 2 locations) frontend/src/components/charts/RegimeTimeline.tsx:121 — frontend/src/components/charts/RegimeTimeline.tsx:121 · frontend/src/pages/Compare.tsx:209 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (19 lines × 2 locations) frontend/src/pages/PaperTrading.tsx:256 — frontend/src/pages/PaperTrading.tsx:256 · frontend/src/pages/PaperTrading.tsx:383 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (16 lines × 3 locations) · ×2
  • Duplicated block (16 lines × 3 locations) frontend/src/lib/swarmStatus.ts:306 — frontend/src/lib/swarmStatus.ts:306 · frontend/src/lib/swarmStatus.ts:326 · frontend/src/lib/swarmStatus.ts:345 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (16 lines × 3 locations) frontend/src/pages/Settings.tsx:493 — frontend/src/pages/Settings.tsx:493 · frontend/src/pages/Settings.tsx:643 · frontend/src/pages/Settings.tsx:678 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 3 locations) · ×2
  • Duplicated block (12 lines × 3 locations) frontend/src/pages/Settings.tsx:510 — frontend/src/pages/Settings.tsx:510 · frontend/src/pages/Settings.tsx:662 · frontend/src/pages/Settings.tsx:697 — all 3 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
  • Duplicated block (12 lines × 3 locations) frontend/src/pages/Settings.tsx:534 — frontend/src/pages/Settings.tsx:534 · frontend/src/pages/Settings.tsx:547 · frontend/src/pages/Settings.tsx:560 — 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.
AC3 · Page structure · Page without a main landmark · ×1
  • Page without a main landmark agent/src/shadow_account/templates/shadow_report.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.9 · ×1
  • Low contrast colour pair in CSS (2.9:1) agent/src/shadow_account/templates/shadow_report.css:250 — `thead th` sets color: #5f6878 on background-color: #1a1f29 — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×1
  • Focus outline removed in CSS without a :focus replacement wiki/docs/styles.css:112 — `.docs-article` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung frontend/package.json:44 — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 101 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · Agent.Agent (cyclomatic 374) · ×1
  • Agent.Agent (cyclomatic 374) frontend/src/pages/Agent.tsx:233 — Agent.Agent has cyclomatic complexity 374 (threshold 15). Of this number, 26 points are the body's own statements and 348 belong to 75 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scheduled.Scheduled (cyclomatic 116) · ×1
  • Scheduled.Scheduled (cyclomatic 116) frontend/src/pages/Scheduled.tsx:92 — Scheduled.Scheduled has cyclomatic complexity 116 (threshold 15). Of this number, 40 points are the body's own statements and 76 belong to 19 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentLoop._run_bound (cyclomatic 104) · ×1
  • AgentLoop._run_bound (cyclomatic 104) REDACTED:387 — AgentLoop._run_bound has cyclomatic complexity 104 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Portfolio.Portfolio (cyclomatic 78) · ×1
  • Portfolio.Portfolio (cyclomatic 78) frontend/src/pages/Portfolio.tsx:135 — Portfolio.Portfolio has cyclomatic complexity 78 (threshold 15). Of this number, 27 points are the body's own statements and 51 belong to 16 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunDetail.RunDetail (cyclomatic 75) · ×1
  • RunDetail.RunDetail (cyclomatic 75) frontend/src/pages/RunDetail.tsx:124 — RunDetail.RunDetail has cyclomatic complexity 75 (threshold 15). Of this number, 38 points are the body's own statements and 37 belong to 13 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WeixinChannel._process_message (cyclomatic 66) · ×1
  • WeixinChannel._process_message (cyclomatic 66) REDACTED:600 — WeixinChannel._process_message has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · options_portfolio._calc_options_metrics (cyclomatic 58) · ×1
  • options_portfolio._calc_options_metrics (cyclomatic 58) agent/backtest/engines/options_portfolio.py:703 — options_portfolio._calc_options_metrics has cyclomatic complexity 58 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Layout.Layout (cyclomatic 58) · ×1
  • Layout.Layout (cyclomatic 58) frontend/src/components/layout/Layout.tsx:21 — Layout.Layout has cyclomatic complexity 58 (threshold 15). Of this number, 30 points are the body's own statements and 28 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy.main (cyclomatic 57) · ×1
  • _legacy.main (cyclomatic 57) agent/cli/_legacy.py:6742 — _legacy.main has cyclomatic complexity 57 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PortfolioService._collect_source (cyclomatic 53) · ×1
  • PortfolioService._collect_source (cyclomatic 53) agent/src/portfolio/service.py:960 — PortfolioService._collect_source has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · options_portfolio.run_options_backtest (cyclomatic 51) · ×1
  • options_portfolio.run_options_backtest (cyclomatic 51) agent/backtest/engines/options_portfolio.py:199 — options_portfolio.run_options_backtest has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _PolicyMixin._derivation (cyclomatic 49) · ×1
  • _PolicyMixin._derivation (cyclomatic 49) agent/src/agent/grounding/policies.py:1888 — _PolicyMixin._derivation has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Compare.Compare (cyclomatic 49) · ×1
  • Compare.Compare (cyclomatic 49) frontend/src/pages/Compare.tsx:235 — Compare.Compare has cyclomatic complexity 49 (threshold 15). Of this number, 24 points are the body's own statements and 25 belong to 14 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · feishu._extract_element_content (cyclomatic 48) · ×1
  • feishu._extract_element_content (cyclomatic 48) agent/src/channels/feishu.py:204 — feishu._extract_element_content 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 · BaseEngine._execute_bars (cyclomatic 47) · ×1
  • BaseEngine._execute_bars (cyclomatic 47) agent/backtest/engines/base.py:1255 — BaseEngine._execute_bars has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bench_runner.run_bench (cyclomatic 47) · ×1
  • bench_runner.run_bench (cyclomatic 47) agent/src/factors/bench_runner.py:144 — bench_runner.run_bench has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worker._run_worker_impl (cyclomatic 47) · ×1
  • worker._run_worker_impl (cyclomatic 47) agent/src/swarm/worker.py:612 — worker._run_worker_impl has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OptionsLab.OptionsLab (cyclomatic 47) · ×1
  • OptionsLab.OptionsLab (cyclomatic 47) frontend/src/pages/OptionsLab.tsx:58 — OptionsLab.OptionsLab has cyclomatic complexity 47 (threshold 15). Of this number, 36 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · service.build_job_from_draft (cyclomatic 45) · ×1
  • service.build_job_from_draft (cyclomatic 45) agent/src/scheduled_research/service.py:136 — service.build_job_from_draft has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · figures.scan_figures (cyclomatic 44) · ×1
  • figures.scan_figures (cyclomatic 44) agent/src/agent/grounding/figures.py:1224 — figures.scan_figures has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelSettings.ChannelSettings (cyclomatic 44) · ×1
  • ChannelSettings.ChannelSettings (cyclomatic 44) frontend/src/components/settings/ChannelSettings.tsx:24 — ChannelSettings.ChannelSettings has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 13 of the 44 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 235, setChannelsRunning, a function literal at line 38, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · runner.fetch_data_map (cyclomatic 43) · ×1
  • runner.fetch_data_map (cyclomatic 43) agent/backtest/runner.py:2017 — runner.fetch_data_map has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bench_runner_strict.run_bench_strict (cyclomatic 43) · ×1
  • bench_runner_strict.run_bench_strict (cyclomatic 43) agent/src/factors/bench_runner_strict.py:319 — bench_runner_strict.run_bench_strict has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatLLM.stream_chat (cyclomatic 43) · ×1
  • ChatLLM.stream_chat (cyclomatic 43) agent/src/providers/chat.py:480 — ChatLLM.stream_chat has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · openai_codex._message_chunks_from_events (cyclomatic 43) · ×1
  • openai_codex._message_chunks_from_events (cyclomatic 43) agent/src/providers/openai_codex.py:632 — openai_codex._message_chunks_from_events has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · schema._validate_expectations (cyclomatic 42) · ×1
  • schema._validate_expectations (cyclomatic 42) agent/evals/harness/schema.py:79 — schema._validate_expectations has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EmailChannel.send (cyclomatic 42) · ×1
  • EmailChannel.send (cyclomatic 42) agent/src/channels/email.py:265 — EmailChannel.send has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cli_handlers.cmd_alpha_bench (cyclomatic 42) · ×1
  • cli_handlers.cmd_alpha_bench (cyclomatic 42) agent/src/factors/cli_handlers.py:566 — cli_handlers.cmd_alpha_bench has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunnerStatus.BrokerRow (cyclomatic 42) · ×1
  • RunnerStatus.BrokerRow (cyclomatic 42) frontend/src/components/chat/RunnerStatus.tsx:121 — RunnerStatus.BrokerRow has cyclomatic complexity 42 (threshold 15). Of this number, 34 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · swarmStatus.applySwarmEvent (cyclomatic 42) · ×1
  • swarmStatus.applySwarmEvent (cyclomatic 42) frontend/src/lib/swarmStatus.ts:209 — swarmStatus.applySwarmEvent has cyclomatic complexity 42 (threshold 15). Of this number, 23 points are the body's own statements and 19 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _IdentityMixin._ingest_resolution (cyclomatic 41) · ×1
  • _IdentityMixin._ingest_resolution (cyclomatic 41) agent/src/agent/grounding/identity.py:704 — _IdentityMixin._ingest_resolution 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 · eventstudy.event_study (cyclomatic 41) · ×1
  • eventstudy.event_study (cyclomatic 41) agent/src/quantlib/eventstudy.py:325 — eventstudy.event_study 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 · CandlestickChart.CandlestickChart (cyclomatic 41) · ×1
  • CandlestickChart.CandlestickChart (cyclomatic 41) frontend/src/components/charts/CandlestickChart.tsx:37 — CandlestickChart.CandlestickChart has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 3 of the 41 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 114, 222, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ConnectionCenter.ConnectionCard (cyclomatic 41) · ×1
  • ConnectionCenter.ConnectionCard (cyclomatic 41) frontend/src/components/portfolio/ConnectionCenter.tsx:169 — ConnectionCenter.ConnectionCard has cyclomatic complexity 41 (threshold 15). Of this number, 28 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _PolicyMixin._referenced (cyclomatic 40) · ×1
  • _PolicyMixin._referenced (cyclomatic 40) agent/src/agent/grounding/policies.py:789 — _PolicyMixin._referenced has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _PolicyMixin._check_observed (cyclomatic 40) · ×1
  • _PolicyMixin._check_observed (cyclomatic 40) agent/src/agent/grounding/policies.py:1643 — _PolicyMixin._check_observed has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp.quote_summary (cyclomatic 40) · ×1
  • mcp.quote_summary (cyclomatic 40) agent/src/trading/connectors/robinhood/mcp.py:352 — mcp.quote_summary has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MandateProposalCard.MandateProposalCard (cyclomatic 40) · ×1
  • MandateProposalCard.MandateProposalCard (cyclomatic 40) frontend/src/components/chat/MandateProposalCard.tsx:203 — MandateProposalCard.MandateProposalCard has cyclomatic complexity 40 (threshold 15). Of this number, 23 points are the body's own statements and 17 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Settings.Settings (cyclomatic 40) · ×1
  • Settings.Settings (cyclomatic 40) frontend/src/pages/Settings.tsx:41 — Settings.Settings has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Settings.Settings::submit, Settings.Settings::submitDataSources) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · VibeTradingDingTalkHandler.process (cyclomatic 39) · ×1
  • VibeTradingDingTalkHandler.process (cyclomatic 39) agent/src/channels/dingtalk.py:57 — VibeTradingDingTalkHandler.process has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SlackChannel._on_socket_request (cyclomatic 39) · ×1
  • SlackChannel._on_socket_request (cyclomatic 39) agent/src/channels/slack.py:335 — SlackChannel._on_socket_request has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · normalization.normalize_position (cyclomatic 39) · ×1
  • normalization.normalize_position (cyclomatic 39) agent/src/portfolio/normalization.py:56 — normalization.normalize_position has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ScheduledResearchJob.from_dict (cyclomatic 39) · ×1
  • ScheduledResearchJob.from_dict (cyclomatic 39) agent/src/scheduled_research/models.py:313 — ScheduledResearchJob.from_dict has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WebSearchTool.execute (cyclomatic 39) · ×1
  • WebSearchTool.execute (cyclomatic 39) agent/src/tools/web_search_tool.py:173 — WebSearchTool.execute has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CustomProviderManager.CustomProviderManager (cyclomatic 39) · ×1
  • CustomProviderManager.CustomProviderManager (cyclomatic 39) frontend/src/components/settings/CustomProviderManager.tsx:20 — CustomProviderManager.CustomProviderManager has cyclomatic complexity 39 (threshold 15). Of this number, 23 points are the body's own statements and 16 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ingest._load_panel_long (cyclomatic 38) · ×1
  • ingest._load_panel_long (cyclomatic 38) agent/src/entities/ingest.py:928 — ingest._load_panel_long has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · options.barrier_option_price (cyclomatic 38) · ×1
  • options.barrier_option_price (cyclomatic 38) agent/src/quantlib/options.py:517 — options.barrier_option_price has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlphaZoo.BrowseView (cyclomatic 38) · ×1
  • AlphaZoo.BrowseView (cyclomatic 38) frontend/src/pages/AlphaZoo.tsx:143 — AlphaZoo.BrowseView has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 12 of the 38 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 197, 386, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · runs_routes._build_response_from_run_dir (cyclomatic 37) · ×1
  • runs_routes._build_response_from_run_dir (cyclomatic 37) agent/src/api/runs_routes.py:680 — runs_routes._build_response_from_run_dir has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TelegramChannel.send_delta (cyclomatic 37) · ×1
  • TelegramChannel.send_delta (cyclomatic 37) agent/src/channels/telegram.py:937 — TelegramChannel.send_delta has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WecomChannel._process_message (cyclomatic 37) · ×1
  • WecomChannel._process_message (cyclomatic 37) REDACTED:223 — WecomChannel._process_message has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · llm.build_llm (cyclomatic 37) · ×1
  • llm.build_llm (cyclomatic 37) agent/src/providers/llm.py:1645 — llm.build_llm has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RailRunDashboard.handle_event (cyclomatic 36) · ×1
  • RailRunDashboard.handle_event (cyclomatic 36) agent/cli/ui/rail.py:320 — RailRunDashboard.handle_event has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cli_handlers.cmd_alpha_show (cyclomatic 36) · ×1
  • cli_handlers.cmd_alpha_show (cyclomatic 36) agent/src/factors/cli_handlers.py:302 — cli_handlers.cmd_alpha_show has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · symbol_search_tool._search_selected_connector (cyclomatic 36) · ×1
  • symbol_search_tool._search_selected_connector (cyclomatic 36) agent/src/tools/symbol_search_tool.py:546 — symbol_search_tool._search_selected_connector has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FeishuChannel._on_message (cyclomatic 35) · ×1
  • FeishuChannel._on_message (cyclomatic 35) agent/src/channels/feishu.py:2261 — FeishuChannel._on_message has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WhatsAppChannel._handle_neonize_message (cyclomatic 35) · ×1
  • WhatsAppChannel._handle_neonize_message (cyclomatic 35) agent/src/channels/whatsapp.py:503 — WhatsAppChannel._handle_neonize_message has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _PolicyMixin._validate_figures (cyclomatic 34) · ×1
  • _PolicyMixin._validate_figures (cyclomatic 34) agent/src/agent/grounding/policies.py:457 — _PolicyMixin._validate_figures has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · alpha_bench_tool.run_alpha_bench (cyclomatic 34) · ×1
  • alpha_bench_tool.run_alpha_bench (cyclomatic 34) agent/src/tools/alpha_bench_tool.py:1268 — alpha_bench_tool.run_alpha_bench has cyclomatic complexity 34 (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 · trade_journal_parsers._futu_datetime (cyclomatic 34) · ×1
  • trade_journal_parsers._futu_datetime (cyclomatic 34) agent/src/tools/trade_journal_parsers.py:473 — trade_journal_parsers._futu_datetime has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelConfigPanel.ChannelConfigPanel (cyclomatic 34) · ×1
  • ChannelConfigPanel.ChannelConfigPanel (cyclomatic 34) frontend/src/components/settings/ChannelConfigPanel.tsx:193 — ChannelConfigPanel.ChannelConfigPanel has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ChannelConfigPanel.ChannelConfigPanel::renderField) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · agent.useAgentStore (cyclomatic 34) · ×1
  • agent.useAgentStore (cyclomatic 34) frontend/src/stores/agent.ts:120 — agent.useAgentStore has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 19 function literals inside it that branch (lines 208, 141, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · EmailChannel._fetch_messages_once (cyclomatic 33) · ×1
  • EmailChannel._fetch_messages_once (cyclomatic 33) agent/src/channels/email.py:537 — EmailChannel._fetch_messages_once has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebSocketChannel.send (cyclomatic 33) · ×1
  • WebSocketChannel.send (cyclomatic 33) REDACTED:884 — WebSocketChannel.send has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StrategyDiscoveryFacade.query_strategies (cyclomatic 33) · ×1
  • StrategyDiscoveryFacade.query_strategies (cyclomatic 33) agent/src/strategy_discovery/facade.py:417 — StrategyDiscoveryFacade.query_strategies has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tool._execute_step (cyclomatic 33) · ×1
  • tool._execute_step (cyclomatic 33) agent/src/tools/paper_trade/tool.py:229 — tool._execute_step has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TechnicalIndicatorTool.execute (cyclomatic 33) · ×1
  • TechnicalIndicatorTool.execute (cyclomatic 33) agent/src/tools/technical_indicator_tool.py:322 — TechnicalIndicatorTool.execute has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FactorResearchPanel.FactorResearchPanel (cyclomatic 33) · ×1
  • FactorResearchPanel.FactorResearchPanel (cyclomatic 33) frontend/src/components/charts/FactorResearchPanel.tsx:84 — FactorResearchPanel.FactorResearchPanel has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 113, 175, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PaperTrading.PaperTrading (cyclomatic 33) · ×1
  • PaperTrading.PaperTrading (cyclomatic 33) frontend/src/pages/PaperTrading.tsx:18 — PaperTrading.PaperTrading has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 15 function items inside it that branch (advance, a function literal at line 44, a function literal at line 47, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AgentLoop._auto_compact (cyclomatic 32) · ×1
  • AgentLoop._auto_compact (cyclomatic 32) REDACTED:1521 — AgentLoop._auto_compact has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WeixinChannel.send (cyclomatic 32) · ×1
  • WeixinChannel.send (cyclomatic 32) REDACTED:1090 — WeixinChannel.send has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tools.build_registry (cyclomatic 32) · ×1
  • tools.build_registry (cyclomatic 32) agent/src/tools/__init__.py:77 — tools.build_registry has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AddGoalEvidenceTool.execute (cyclomatic 32) · ×1
  • AddGoalEvidenceTool.execute (cyclomatic 32) agent/src/tools/goal_tool.py:491 — AddGoalEvidenceTool.execute has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PositionsTab.PositionsTab (cyclomatic 32) · ×1
  • PositionsTab.PositionsTab (cyclomatic 32) frontend/src/components/run/PositionsTab.tsx:97 — PositionsTab.PositionsTab has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 174, handleResolve, a function literal at line 160, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · metrics.calc_metrics (cyclomatic 31) · ×1
  • metrics.calc_metrics (cyclomatic 31) agent/backtest/metrics.py:563 — metrics.calc_metrics has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main._interactive_loop (cyclomatic 31) · ×1
  • main._interactive_loop (cyclomatic 31) agent/cli/main.py:1295 — main._interactive_loop has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebSocketChannel._dispatch_envelope (cyclomatic 31) · ×1
  • WebSocketChannel._dispatch_envelope (cyclomatic 31) REDACTED:672 — WebSocketChannel._dispatch_envelope has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · combination.combine_factors (cyclomatic 31) · ×1
  • combination.combine_factors (cyclomatic 31) agent/src/quantlib/combination.py:316 — combination.combine_factors has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OptionsChainTable.OptionsChainTable (cyclomatic 31) · ×1
  • OptionsChainTable.OptionsChainTable (cyclomatic 31) frontend/src/components/options/OptionsChainTable.tsx:139 — OptionsChainTable.OptionsChainTable has cyclomatic complexity 31 (threshold 15). Of this number, 17 points are the body's own statements and 14 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QVerisSettings.QVerisSettings (cyclomatic 31) · ×1
  • QVerisSettings.QVerisSettings (cyclomatic 31) frontend/src/components/settings/QVerisSettings.tsx:80 — QVerisSettings.QVerisSettings has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (submit, load, a function literal at line 129, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · argentina_equity._field_problems (cyclomatic 30) · ×1
  • argentina_equity._field_problems (cyclomatic 30) agent/backtest/engines/argentina_equity.py:872 — argentina_equity._field_problems has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseEngine._execute_target_rebalance (cyclomatic 30) · ×1
  • BaseEngine._execute_target_rebalance (cyclomatic 30) agent/backtest/engines/base.py:1763 — BaseEngine._execute_target_rebalance has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _RunDashboard.handle_event (cyclomatic 30) · ×1
  • _RunDashboard.handle_event (cyclomatic 30) agent/cli/_legacy.py:604 — _RunDashboard.handle_event has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · feishu._extract_interactive_content (cyclomatic 30) · ×1
  • feishu._extract_interactive_content (cyclomatic 30) agent/src/channels/feishu.py:133 — feishu._extract_interactive_content has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PersistentMemory.find_relevant (cyclomatic 30) · ×1
  • PersistentMemory.find_relevant (cyclomatic 30) agent/src/memory/persistent.py:366 — PersistentMemory.find_relevant has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResearchPapersTool.execute (cyclomatic 30) · ×1
  • ResearchPapersTool.execute (cyclomatic 30) agent/src/tools/research_papers_tool.py:1557 — ResearchPapersTool.execute has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · local_plugins.parse_manifest (cyclomatic 30) · ×1
  • local_plugins.parse_manifest (cyclomatic 30) agent/src/trading/local_plugins.py:108 — local_plugins.parse_manifest has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · StrategyResearchDashboard.StrategyResearchDashboard (cyclomatic 30) · ×1
  • StrategyResearchDashboard.StrategyResearchDashboard (cyclomatic 30) frontend/src/components/charts/StrategyResearchDashboard.tsx:122 — StrategyResearchDashboard.StrategyResearchDashboard has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 140, 129, 195, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Reports.Reports (cyclomatic 30) · ×1
  • Reports.Reports (cyclomatic 30) frontend/src/pages/Reports.tsx:23 — Reports.Reports has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 66, loadReports, a function literal at line 60, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · binance_shadow_evidence._validate_evidence (cyclomatic 29) · ×1
  • binance_shadow_evidence._validate_evidence (cyclomatic 29) agent/backtest/binance_shadow_evidence.py:262 — binance_shadow_evidence._validate_evidence has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · run_card._model_provenance (cyclomatic 29) · ×1
  • run_card._model_provenance (cyclomatic 29) agent/backtest/run_card.py:47 — run_card._model_provenance 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 · _legacy._print_connector_account (cyclomatic 29) · ×1
  • _legacy._print_connector_account (cyclomatic 29) agent/cli/_legacy.py:4939 — _legacy._print_connector_account 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 · rail._result_summary (cyclomatic 29) · ×1
  • rail._result_summary (cyclomatic 29) agent/cli/ui/rail.py:125 — rail._result_summary 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 · ToolCallLifecycle._process_tool_calls (cyclomatic 29) · ×1
  • ToolCallLifecycle._process_tool_calls (cyclomatic 29) agent/src/agent/tool_lifecycle.py:49 — ToolCallLifecycle._process_tool_calls 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 · MSTeamsChannel._handle_activity (cyclomatic 29) · ×1
  • MSTeamsChannel._handle_activity (cyclomatic 29) agent/src/channels/msteams.py:331 — MSTeamsChannel._handle_activity has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ingest.load_cashflows (cyclomatic 29) · ×1
  • ingest.load_cashflows (cyclomatic 29) agent/src/entities/ingest.py:365 — ingest.load_cashflows 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 · config.parse_settings (cyclomatic 29) · ×1
  • config.parse_settings (cyclomatic 29) agent/src/portfolio/config.py:144 — config.parse_settings 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 · FinancialRigorTool.execute (cyclomatic 29) · ×1
  • FinancialRigorTool.execute (cyclomatic 29) agent/src/tools/financial_rigor_tool.py:549 — FinancialRigorTool.execute has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SourcePrioritySettings.SourcePrioritySettings (cyclomatic 29) · ×1
  • SourcePrioritySettings.SourcePrioritySettings (cyclomatic 29) frontend/src/components/settings/SourcePrioritySettings.tsx:24 — SourcePrioritySettings.SourcePrioritySettings has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 10 function items inside it that branch (submit, a function literal at line 65, a function literal at line 71, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ResearchArtifacts.ResearchArtifacts (cyclomatic 29) · ×1
  • ResearchArtifacts.ResearchArtifacts (cyclomatic 29) frontend/src/pages/ResearchArtifacts.tsx:66 — ResearchArtifacts.ResearchArtifacts has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 5 function items inside it that branch (save, loadArtifacts, openArtifact, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · _legacy._print_portfolio_snapshot (cyclomatic 28) · ×1
  • _legacy._print_portfolio_snapshot (cyclomatic 28) agent/cli/_legacy.py:4200 — _legacy._print_portfolio_snapshot has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · _legacy.cmd_connector_positions (cyclomatic 28) · ×1
  • _legacy.cmd_connector_positions (cyclomatic 28) agent/cli/_legacy.py:5033 — _legacy.cmd_connector_positions has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelRuntime._handle_inbound (cyclomatic 28) · ×1
  • ChannelRuntime._handle_inbound (cyclomatic 28) agent/src/channels/runtime.py:122 — ChannelRuntime._handle_inbound has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cli_handlers.cmd_alpha_list (cyclomatic 28) · ×1
  • cli_handlers.cmd_alpha_list (cyclomatic 28) agent/src/factors/cli_handlers.py:188 — cli_handlers.cmd_alpha_list has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · neutralization.neutralize_factor (cyclomatic 28) · ×1
  • neutralization.neutralize_factor (cyclomatic 28) agent/src/quantlib/neutralization.py:204 — neutralization.neutralize_factor has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · etf_holdings_tool._parse_cn_period (cyclomatic 28) · ×1
  • etf_holdings_tool._parse_cn_period (cyclomatic 28) agent/src/tools/etf_holdings_tool.py:891 — etf_holdings_tool._parse_cn_period has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · etf_holdings_tool._holdings_cn (cyclomatic 28) · ×1
  • etf_holdings_tool._holdings_cn (cyclomatic 28) agent/src/tools/etf_holdings_tool.py:1490 — etf_holdings_tool._holdings_cn has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReadFileTool.execute (cyclomatic 28) · ×1
  • ReadFileTool.execute (cyclomatic 28) agent/src/tools/read_file_tool.py:107 — ReadFileTool.execute has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConnectionStore._parse (cyclomatic 28) · ×1
  • ConnectionStore._parse (cyclomatic 28) agent/src/trading/connections.py:356 — ConnectionStore._parse has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 28) · ×1
  • sdk.place_order (cyclomatic 28) agent/src/trading/connectors/binance/sdk.py:527 — sdk.place_order has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RunDetail.TradesTab (cyclomatic 28) · ×1
  • RunDetail.TradesTab (cyclomatic 28) frontend/src/pages/RunDetail.tsx:1001 — RunDetail.TradesTab has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 11 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1112, 1020, 1053, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Runtime.Runtime (cyclomatic 28) · ×1
  • Runtime.Runtime (cyclomatic 28) frontend/src/pages/Runtime.tsx:25 — Runtime.Runtime has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseEngine.run_backtest (cyclomatic 27) · ×1
  • BaseEngine.run_backtest (cyclomatic 27) agent/backtest/engines/base.py:936 — BaseEngine.run_backtest has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy._print_result (cyclomatic 27) · ×1
  • _legacy._print_result (cyclomatic 27) agent/cli/_legacy.py:1411 — _legacy._print_result has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GroundingLedger.ingest_tool_result (cyclomatic 27) · ×1
  • GroundingLedger.ingest_tool_result (cyclomatic 27) agent/src/agent/grounding/ledger.py:280 — GroundingLedger.ingest_tool_result has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _PolicyMixin._artifact_scope (cyclomatic 27) · ×1
  • _PolicyMixin._artifact_scope (cyclomatic 27) agent/src/agent/grounding/policies.py:1022 — _PolicyMixin._artifact_scope has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · attribution_core._build_attribution_payload (cyclomatic 27) · ×1
  • attribution_core._build_attribution_payload (cyclomatic 27) agent/src/api/attribution_core.py:767 — attribution_core._build_attribution_payload has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TelegramChannel.send (cyclomatic 27) · ×1
  • TelegramChannel.send (cyclomatic 27) agent/src/channels/telegram.py:750 — TelegramChannel.send has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResearchArtifactStore.save (cyclomatic 27) · ×1
  • ResearchArtifactStore.save (cyclomatic 27) agent/src/research_artifacts/store.py:180 — ResearchArtifactStore.save has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 27) · ×1
  • sdk.place_order (cyclomatic 27) agent/src/trading/connectors/futu/sdk.py:769 — sdk.place_order has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy.cmd_connector_setup (cyclomatic 26) · ×1
  • _legacy.cmd_connector_setup (cyclomatic 26) agent/cli/_legacy.py:4555 — _legacy.cmd_connector_setup has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _legacy._dispatch_connector (cyclomatic 26) · ×1
  • _legacy._dispatch_connector (cyclomatic 26) agent/cli/_legacy.py:5419 — _legacy._dispatch_connector has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _EvidenceMixin._ingest_engine_table (cyclomatic 26) · ×1
  • _EvidenceMixin._ingest_engine_table (cyclomatic 26) agent/src/agent/grounding/evidence.py:1056 — _EvidenceMixin._ingest_engine_table has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolCallLifecycle._finalize_tool_result (cyclomatic 26) · ×1
  • ToolCallLifecycle._finalize_tool_result (cyclomatic 26) agent/src/agent/tool_lifecycle.py:796 — ToolCallLifecycle._finalize_tool_result has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WeixinChannel._download_media_item (cyclomatic 26) · ×1
  • WeixinChannel._download_media_item (cyclomatic 26) REDACTED:831 — WeixinChannel._download_media_item has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PortfolioService.refresh (cyclomatic 26) · ×1
  • PortfolioService.refresh (cyclomatic 26) agent/src/portfolio/service.py:301 — PortfolioService.refresh has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · evidence_harness.compute_evidence_for_run (cyclomatic 26) · ×1
  • evidence_harness.compute_evidence_for_run (cyclomatic 26) agent/src/strategy_discovery/evidence_harness.py:411 — evidence_harness.compute_evidence_for_run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InstitutionalHoldingsTool._ticker_holders (cyclomatic 26) · ×1
  • InstitutionalHoldingsTool._ticker_holders (cyclomatic 26) agent/src/tools/institutional_holdings_tool.py:1998 — InstitutionalHoldingsTool._ticker_holders has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunCompleteCard.RunCompleteCard (cyclomatic 26) · ×1
  • RunCompleteCard.RunCompleteCard (cyclomatic 26) frontend/src/components/chat/RunCompleteCard.tsx:25 — RunCompleteCard.RunCompleteCard has cyclomatic complexity 26 (threshold 15). Of this number, 13 points are the body's own statements and 13 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConnectionCenter.ConnectionCenter (cyclomatic 26) · ×1
  • ConnectionCenter.ConnectionCenter (cyclomatic 26) frontend/src/components/portfolio/ConnectionCenter.tsx:21 — ConnectionCenter.ConnectionCenter has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 8 function items inside it that branch (create, test, compatibilityLabel, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ChannelConfigPanel.ChannelConfigPanel · ×1
  • ChannelConfigPanel.ChannelConfigPanel::renderField (cyclomatic 26) frontend/src/components/settings/ChannelConfigPanel.tsx:534 — ChannelConfigPanel.ChannelConfigPanel::renderField has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ChannelConfigPanel.ChannelConfigPanel) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · useAlphaJob.useAlphaJob.connect (cyclomatic 26) · ×1
  • useAlphaJob.useAlphaJob.connect (cyclomatic 26) frontend/src/hooks/useAlphaJob.ts:19 — useAlphaJob.useAlphaJob.connect has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 50, 60, 37, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · AlphaZoo.BenchView (cyclomatic 26) · ×1
  • AlphaZoo.BenchView (cyclomatic 26) frontend/src/pages/AlphaZoo.tsx:641 — AlphaZoo.BenchView has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · base._read_loader_cache_frame (cyclomatic 25) · ×1
  • base._read_loader_cache_frame (cyclomatic 25) agent/backtest/loaders/base.py:723 — base._read_loader_cache_frame has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tushare_fundamentals.enrich_price_frames_with_fundamentals (cyclomatic 25) · ×1
  • tushare_fundamentals.enrich_price_frames_with_fundamentals (cyclomatic 25) agent/backtest/loaders/tushare_fundamentals.py:311 — tushare_fundamentals.enrich_price_frames_with_fundamentals has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _legacy.cmd_connector_check (cyclomatic 25) · ×1
  • _legacy.cmd_connector_check (cyclomatic 25) agent/cli/_legacy.py:4468 — _legacy.cmd_connector_check has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · figures._numbers (cyclomatic 25) · ×1
  • figures._numbers (cyclomatic 25) agent/src/agent/grounding/figures.py:451 — figures._numbers has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loop_grounding.validate_and_release (cyclomatic 25) · ×1
  • loop_grounding.validate_and_release (cyclomatic 25) agent/src/agent/loop_grounding.py:30 — loop_grounding.validate_and_release has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FeishuChannel.send (cyclomatic 25) · ×1
  • FeishuChannel.send (cyclomatic 25) agent/src/channels/feishu.py:2037 — FeishuChannel.send has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PendingAction.validate_evidence (cyclomatic 25) · ×1
  • PendingAction.validate_evidence (cyclomatic 25) agent/src/live/pending_action.py:161 — PendingAction.validate_evidence has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SignalEngine._evaluate_signals (cyclomatic 25) · ×1
  • SignalEngine._evaluate_signals (cyclomatic 25) agent/src/skills/chanlun/example_signal_engine.py:134 — SignalEngine._evaluate_signals has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SymbolSearchTool.execute (cyclomatic 25) · ×1
  • SymbolSearchTool.execute (cyclomatic 25) agent/src/tools/symbol_search_tool.py:254 — SymbolSearchTool.execute has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 25) · ×1
  • sdk.place_order (cyclomatic 25) agent/src/trading/connectors/kis/sdk.py:470 — sdk.place_order has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · tap_forward.forward (cyclomatic 25) · ×1
  • tap_forward.forward (cyclomatic 25) REDACTED:105 — tap_forward.forward has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Correlation.Correlation (cyclomatic 25) · ×1
  • Correlation.Correlation (cyclomatic 25) frontend/src/pages/Correlation.tsx:11 — Correlation.Correlation has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · run_card._render_markdown (cyclomatic 24) · ×1
  • run_card._render_markdown (cyclomatic 24) agent/backtest/run_card.py:510 — run_card._render_markdown has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runner._fetch_auto (cyclomatic 24) · ×1
  • runner._fetch_auto (cyclomatic 24) agent/backtest/runner.py:1901 — runner._fetch_auto has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _RunDashboard.render (cyclomatic 24) · ×1
  • _RunDashboard.render (cyclomatic 24) agent/cli/_legacy.py:795 — _RunDashboard.render has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings_routes._list_openai_codex_models (cyclomatic 24) · ×1
  • settings_routes._list_openai_codex_models (cyclomatic 24) agent/src/api/settings_routes.py:330 — settings_routes._list_openai_codex_models has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SlackChannel.send (cyclomatic 24) · ×1
  • SlackChannel.send (cyclomatic 24) agent/src/channels/slack.py:174 — SlackChannel.send 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 · portfolio.hierarchical_risk_parity (cyclomatic 24) · ×1
  • portfolio.hierarchical_risk_parity (cyclomatic 24) agent/src/quantlib/portfolio.py:102 — portfolio.hierarchical_risk_parity has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OrderBookDepthTool.execute (cyclomatic 24) · ×1
  • OrderBookDepthTool.execute (cyclomatic 24) agent/src/tools/orderbook_depth_tool.py:346 — OrderBookDepthTool.execute has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · trade_journal_tool.pair_trades_fifo (cyclomatic 24) · ×1
  • trade_journal_tool.pair_trades_fifo (cyclomatic 24) agent/src/tools/trade_journal_tool.py:76 — trade_journal_tool.pair_trades_fifo has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolProgressIndicator.ToolRow (cyclomatic 24) · ×1
  • ToolProgressIndicator.ToolRow (cyclomatic 24) frontend/src/components/chat/ToolProgressIndicator.tsx:128 — ToolProgressIndicator.ToolRow has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · options.buildPayoffRequest (cyclomatic 24) · ×1
  • options.buildPayoffRequest (cyclomatic 24) frontend/src/lib/options.ts:181 — options.buildPayoffRequest has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlphaZoo.DetailView (cyclomatic 24) · ×1
  • AlphaZoo.DetailView (cyclomatic 24) frontend/src/pages/AlphaZoo.tsx:457 — AlphaZoo.DetailView has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RunDetail.RunCardTab (cyclomatic 24) · ×1
  • RunDetail.RunCardTab (cyclomatic 24) frontend/src/pages/RunDetail.tsx:477 — RunDetail.RunCardTab has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · runner._reject_forbidden_node (cyclomatic 23) · ×1
  • runner._reject_forbidden_node (cyclomatic 23) agent/backtest/runner.py:659 — runner._reject_forbidden_node 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 · _RunDashboard._render_progress_row (cyclomatic 23) · ×1
  • _RunDashboard._render_progress_row (cyclomatic 23) agent/cli/_legacy.py:719 — _RunDashboard._render_progress_row has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _SwarmDashboard.handle_event (cyclomatic 23) · ×1
  • _SwarmDashboard.handle_event (cyclomatic 23) agent/cli/_legacy.py:2162 — _SwarmDashboard.handle_event has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _legacy.cmd_trace (cyclomatic 23) · ×1
  • _legacy.cmd_trace (cyclomatic 23) agent/cli/_legacy.py:2604 — _legacy.cmd_trace 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 · identity._infer_instrument_type (cyclomatic 23) · ×1
  • identity._infer_instrument_type (cyclomatic 23) agent/src/agent/grounding/identity.py:347 — identity._infer_instrument_type has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · write_targets.record_written_target (cyclomatic 23) · ×1
  • write_targets.record_written_target (cyclomatic 23) agent/src/agent/write_targets.py:29 — write_targets.record_written_target 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 · runs_routes._scan_factor_results (cyclomatic 23) · ×1
  • runs_routes._scan_factor_results (cyclomatic 23) agent/src/api/runs_routes.py:288 — runs_routes._scan_factor_results 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 · FeishuChannel.send_delta (cyclomatic 23) · ×1
  • FeishuChannel.send_delta (cyclomatic 23) agent/src/channels/feishu.py:1881 — FeishuChannel.send_delta 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 · QQChannel._download_to_media_dir_chunked (cyclomatic 23) · ×1
  • QQChannel._download_to_media_dir_chunked (cyclomatic 23) agent/src/channels/qq.py:660 — QQChannel._download_to_media_dir_chunked has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sdk_order_gate._allow (cyclomatic 23) · ×1
  • sdk_order_gate._allow (cyclomatic 23) agent/src/live/sdk_order_gate.py:434 — sdk_order_gate._allow 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 · adaptation_workflow.prepare_adaptation (cyclomatic 23) · ×1
  • adaptation_workflow.prepare_adaptation (cyclomatic 23) agent/src/strategy_discovery/adaptation_workflow.py:18 — adaptation_workflow.prepare_adaptation has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · run_artifacts.read_trade_activity (cyclomatic 23) · ×1
  • run_artifacts.read_trade_activity (cyclomatic 23) agent/src/strategy_discovery/run_artifacts.py:128 — run_artifacts.read_trade_activity 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 · MarketDataTool.execute (cyclomatic 23) · ×1
  • MarketDataTool.execute (cyclomatic 23) agent/src/tools/market_data_tool.py:157 — MarketDataTool.execute has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PredictionMarketTool.execute (cyclomatic 23) · ×1
  • PredictionMarketTool.execute (cyclomatic 23) agent/src/tools/prediction_market_tool.py:1118 — PredictionMarketTool.execute has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · trading.edit_position_stops (cyclomatic 23) · ×1
  • trading.edit_position_stops (cyclomatic 23) agent/src/trading/connectors/etoro/trading.py:218 — trading.edit_position_stops has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 23) · ×1
  • sdk.place_order (cyclomatic 23) agent/src/trading/connectors/upbit/sdk.py:376 — sdk.place_order has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ui_services.load_run_context (cyclomatic 23) · ×1
  • ui_services.load_run_context (cyclomatic 23) agent/src/ui_services.py:102 — ui_services.load_run_context 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 · ModelPicker.ModelPicker (cyclomatic 23) · ×1
  • ModelPicker.ModelPicker (cyclomatic 23) frontend/src/components/settings/ModelPicker.tsx:13 — ModelPicker.ModelPicker has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 5 function items inside it that branch (onKeyDown, a function literal at line 111, a function literal at line 58, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · yahoo_client._parse_chart (cyclomatic 22) · ×1
  • yahoo_client._parse_chart (cyclomatic 22) agent/backtest/loaders/yahoo_client.py:219 — yahoo_client._parse_chart has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · TurnoverAwareOptimizer._calc_weights (cyclomatic 22) · ×1
  • TurnoverAwareOptimizer._calc_weights (cyclomatic 22) agent/backtest/optimizers/turnover_aware.py:160 — TurnoverAwareOptimizer._calc_weights 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 · runner._select_market_engine (cyclomatic 22) · ×1
  • runner._select_market_engine (cyclomatic 22) agent/backtest/runner.py:1746 — runner._select_market_engine has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · context_compact._verification_ledger (cyclomatic 22) · ×1
  • context_compact._verification_ledger (cyclomatic 22) agent/src/agent/context_compact.py:114 — context_compact._verification_ledger 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 · _EvidenceMixin._record_backtest_metrics (cyclomatic 22) · ×1
  • _EvidenceMixin._record_backtest_metrics (cyclomatic 22) agent/src/agent/grounding/evidence.py:856 — _EvidenceMixin._record_backtest_metrics 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 · _EvidenceMixin._ingest_market_data (cyclomatic 22) · ×1
  • _EvidenceMixin._ingest_market_data (cyclomatic 22) agent/src/agent/grounding/evidence.py:1211 — _EvidenceMixin._ingest_market_data 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 · identity._normalize_symbol (cyclomatic 22) · ×1
  • identity._normalize_symbol (cyclomatic 22) agent/src/agent/grounding/identity.py:164 — identity._normalize_symbol 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 · _PolicyMixin._indexed_field_ref_candidates (cyclomatic 22) · ×1
  • _PolicyMixin._indexed_field_ref_candidates (cyclomatic 22) agent/src/agent/grounding/policies.py:1188 — _PolicyMixin._indexed_field_ref_candidates 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 · EmailChannel.start (cyclomatic 22) · ×1
  • EmailChannel.start (cyclomatic 22) agent/src/channels/email.py:171 — EmailChannel.start 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 · telegram._split_telegram_markdown (cyclomatic 22) · ×1
  • telegram._split_telegram_markdown (cyclomatic 22) agent/src/channels/telegram.py:46 — telegram._split_telegram_markdown 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 · ingest._load_panel_wide (cyclomatic 22) · ×1
  • ingest._load_panel_wide (cyclomatic 22) agent/src/entities/ingest.py:1099 — ingest._load_panel_wide 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 · context.format_goal_continuation_prompt (cyclomatic 22) · ×1
  • context.format_goal_continuation_prompt (cyclomatic 22) agent/src/goal/context.py:94 — context.format_goal_continuation_prompt has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · enforcement.check_mandate (cyclomatic 22) · ×1
  • enforcement.check_mandate (cyclomatic 22) agent/src/live/enforcement.py:476 — enforcement.check_mandate has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · market_data.fetch_market_data (cyclomatic 22) · ×1
  • market_data.fetch_market_data (cyclomatic 22) agent/src/market_data.py:199 — market_data.fetch_market_data 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 · ChatLLM._parse_response (cyclomatic 22) · ×1
  • ChatLLM._parse_response (cyclomatic 22) agent/src/providers/chat.py:664 — ChatLLM._parse_response has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · openai_codex._convert_messages (cyclomatic 22) · ×1
  • openai_codex._convert_messages (cyclomatic 22) agent/src/providers/openai_codex.py:466 — openai_codex._convert_messages has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · neutralization.pca_factors (cyclomatic 22) · ×1
  • neutralization.pca_factors (cyclomatic 22) agent/src/quantlib/neutralization.py:385 — neutralization.pca_factors 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 · ScheduledResearchExecutor.sweep_deliveries (cyclomatic 22) · ×1
  • ScheduledResearchExecutor.sweep_deliveries (cyclomatic 22) agent/src/scheduled_research/executor.py:567 — ScheduledResearchExecutor.sweep_deliveries 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 · SessionService._record_tool_trail_event (cyclomatic 22) · ×1
  • SessionService._record_tool_trail_event (cyclomatic 22) agent/src/session/service.py:732 — SessionService._record_tool_trail_event has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · doc_reader_tool._read_pdf (cyclomatic 22) · ×1
  • doc_reader_tool._read_pdf (cyclomatic 22) agent/src/tools/doc_reader_tool.py:133 — doc_reader_tool._read_pdf 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 · etf_holdings_tool._cn_etf_list (cyclomatic 22) · ×1
  • etf_holdings_tool._cn_etf_list (cyclomatic 22) agent/src/tools/etf_holdings_tool.py:1201 — etf_holdings_tool._cn_etf_list 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 · financial_statements_tool._fetch_sec_statement (cyclomatic 22) · ×1
  • financial_statements_tool._fetch_sec_statement (cyclomatic 22) agent/src/tools/financial_statements_tool.py:683 — financial_statements_tool._fetch_sec_statement 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 · GildataFundNavTool.execute (cyclomatic 22) · ×1
  • GildataFundNavTool.execute (cyclomatic 22) agent/src/tools/fund_nav_tool.py:137 — GildataFundNavTool.execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GetFundamentalsTool.execute (cyclomatic 22) · ×1
  • GetFundamentalsTool.execute (cyclomatic 22) agent/src/tools/get_fundamentals_tool.py:126 — GetFundamentalsTool.execute has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · institutional_holdings_tool._walk_chain (cyclomatic 22) · ×1
  • institutional_holdings_tool._walk_chain (cyclomatic 22) agent/src/tools/institutional_holdings_tool.py:1207 — institutional_holdings_tool._walk_chain 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 · data._fetch_cn_a (cyclomatic 22) · ×1
  • data._fetch_cn_a (cyclomatic 22) agent/src/tools/paper_trade/data.py:647 — data._fetch_cn_a has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · QVerisExecuteTool.execute (cyclomatic 22) · ×1
  • QVerisExecuteTool.execute (cyclomatic 22) agent/src/tools/qveris_tool.py:567 — QVerisExecuteTool.execute has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · research_papers_tool._arxiv_paper (cyclomatic 22) · ×1
  • research_papers_tool._arxiv_paper (cyclomatic 22) agent/src/tools/research_papers_tool.py:1016 — research_papers_tool._arxiv_paper has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · trade_journal_tool._compute_profile (cyclomatic 22) · ×1
  • trade_journal_tool._compute_profile (cyclomatic 22) agent/src/tools/trade_journal_tool.py:237 — trade_journal_tool._compute_profile 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 · service._close_etoro_position (cyclomatic 22) · ×1
  • service._close_etoro_position (cyclomatic 22) agent/src/trading/service.py:874 — service._close_etoro_position 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 · additive_conversion.convert_additive_to_multiplicative (cyclomatic 21) · ×1
  • additive_conversion.convert_additive_to_multiplicative (cyclomatic 21) agent/backtest/loaders/additive_conversion.py:103 — additive_conversion.convert_additive_to_multiplicative has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LongbridgeLoader.fetch (cyclomatic 21) · ×1
  • LongbridgeLoader.fetch (cyclomatic 21) agent/backtest/loaders/longbridge.py:256 — LongbridgeLoader.fetch 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 · _legacy._build_welcome_panel (cyclomatic 21) · ×1
  • _legacy._build_welcome_panel (cyclomatic 21) agent/cli/_legacy.py:1704 — _legacy._build_welcome_panel has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy._handle_slash_command (cyclomatic 21) · ×1
  • _legacy._handle_slash_command (cyclomatic 21) agent/cli/_legacy.py:1950 — _legacy._handle_slash_command has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy.cmd_dev (cyclomatic 21) · ×1
  • _legacy.cmd_dev (cyclomatic 21) agent/cli/_legacy.py:6593 — _legacy.cmd_dev has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · figures.parse_figures_block (cyclomatic 21) · ×1
  • figures.parse_figures_block (cyclomatic 21) agent/src/agent/grounding/figures.py:791 — figures.parse_figures_block 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 · release._correction_line (cyclomatic 21) · ×1
  • release._correction_line (cyclomatic 21) agent/src/agent/grounding/release.py:99 — release._correction_line has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DingTalkChannel._fetch_remote_media_bytes (cyclomatic 21) · ×1
  • DingTalkChannel._fetch_remote_media_bytes (cyclomatic 21) agent/src/channels/dingtalk.py:384 — DingTalkChannel._fetch_remote_media_bytes 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 · MSTeamsChannel._normalize_teams_reply_quote (cyclomatic 21) · ×1
  • MSTeamsChannel._normalize_teams_reply_quote (cyclomatic 21) agent/src/channels/msteams.py:441 — MSTeamsChannel._normalize_teams_reply_quote 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 · HypothesisRegistry.update (cyclomatic 21) · ×1
  • HypothesisRegistry.update (cyclomatic 21) agent/src/hypotheses/registry.py:214 — HypothesisRegistry.update has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · commit._resolve_profile (cyclomatic 21) · ×1
  • commit._resolve_profile (cyclomatic 21) agent/src/live/mandate/commit.py:265 — commit._resolve_profile 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 · stream_guard.supervised_pulls (cyclomatic 21) · ×1
  • stream_guard.supervised_pulls (cyclomatic 21) agent/src/providers/stream_guard.py:131 — stream_guard.supervised_pulls 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 · ResearchPlaybook.to_job (cyclomatic 21) · ×1
  • ResearchPlaybook.to_job (cyclomatic 21) agent/src/scheduled_research/playbooks.py:142 — ResearchPlaybook.to_job has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StrategyDiscoveryFacade.get_strategy_evidence (cyclomatic 21) · ×1
  • StrategyDiscoveryFacade.get_strategy_evidence (cyclomatic 21) agent/src/strategy_discovery/facade.py:606 — StrategyDiscoveryFacade.get_strategy_evidence 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 · EtfHoldingsTool.execute (cyclomatic 21) · ×1
  • EtfHoldingsTool.execute (cyclomatic 21) agent/src/tools/etf_holdings_tool.py:1806 — EtfHoldingsTool.execute has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · institutional_holdings_tool._resolve_chain_value (cyclomatic 21) · ×1
  • institutional_holdings_tool._resolve_chain_value (cyclomatic 21) agent/src/tools/institutional_holdings_tool.py:1431 — institutional_holdings_tool._resolve_chain_value 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 · data.fetch_market_data (cyclomatic 21) · ×1
  • data.fetch_market_data (cyclomatic 21) agent/src/tools/paper_trade/data.py:429 — data.fetch_market_data has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · report_audit_tool._report_value (cyclomatic 21) · ×1
  • report_audit_tool._report_value (cyclomatic 21) agent/src/tools/report_audit_tool.py:64 — report_audit_tool._report_value 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 · sdk.place_order (cyclomatic 21) · ×1
  • sdk.place_order (cyclomatic 21) agent/src/trading/connectors/longbridge/sdk.py:482 — sdk.place_order has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · update-verification.compareSemanticVersions (cyclomatic 21) · ×1
  • update-verification.compareSemanticVersions (cyclomatic 21) desktop/electron/src/update-verification.ts:229 — update-verification.compareSemanticVersions 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 · formatters.metricSentiment (cyclomatic 21) · ×1
  • formatters.metricSentiment (cyclomatic 21) frontend/src/lib/formatters.ts:69 — formatters.metricSentiment 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 · Compare.EquityChartOverlay (cyclomatic 21) · ×1
  • Compare.EquityChartOverlay (cyclomatic 21) frontend/src/pages/Compare.tsx:120 — Compare.EquityChartOverlay has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 124, 162, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · RunDetail.StudioTab (cyclomatic 21) · ×1
  • RunDetail.StudioTab (cyclomatic 21) frontend/src/pages/RunDetail.tsx:622 — RunDetail.StudioTab has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · _SwarmDashboard.build_table (cyclomatic 20) · ×1
  • _SwarmDashboard.build_table (cyclomatic 20) agent/cli/_legacy.py:2233 — _SwarmDashboard.build_table 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 · assertions._identity_verdicts (cyclomatic 20) · ×1
  • assertions._identity_verdicts (cyclomatic 20) agent/evals/harness/assertions.py:347 — assertions._identity_verdicts 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 · mcp_server.alpha_bench (cyclomatic 20) · ×1
  • mcp_server.alpha_bench (cyclomatic 20) agent/mcp_server.py:1008 — mcp_server.alpha_bench 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 · _EvidenceMixin._ingest_analysis_result (cyclomatic 20) · ×1
  • _EvidenceMixin._ingest_analysis_result (cyclomatic 20) agent/src/agent/grounding/evidence.py:730 — _EvidenceMixin._ingest_analysis_result has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ReleaseMixin.redacted_release (cyclomatic 20) · ×1
  • _ReleaseMixin.redacted_release (cyclomatic 20) agent/src/agent/grounding/release.py:539 — _ReleaseMixin.redacted_release 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 · DiscordChannel.send_delta (cyclomatic 20) · ×1
  • DiscordChannel.send_delta (cyclomatic 20) agent/src/channels/discord.py:513 — DiscordChannel.send_delta 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 · EmailChannel._authentication_results_segments (cyclomatic 20) · ×1
  • EmailChannel._authentication_results_segments (cyclomatic 20) agent/src/channels/email.py:959 — EmailChannel._authentication_results_segments 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 · MatrixChannel._upload_and_send_attachment (cyclomatic 20) · ×1
  • MatrixChannel._upload_and_send_attachment (cyclomatic 20) agent/src/channels/matrix.py:458 — MatrixChannel._upload_and_send_attachment 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 · store.handle_pairing_command (cyclomatic 20) · ×1
  • store.handle_pairing_command (cyclomatic 20) agent/src/channels/pairing/store.py:233 — store.handle_pairing_command 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 · SignalChannel._should_respond_in_group (cyclomatic 20) · ×1
  • SignalChannel._should_respond_in_group (cyclomatic 20) REDACTED:1230 — SignalChannel._should_respond_in_group 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 · SSEEventMapper.map (cyclomatic 20) · ×1
  • SSEEventMapper.map (cyclomatic 20) agent/src/openbb_bridge/event_mapper.py:50 — SSEEventMapper.map has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PortfolioService._warnings (cyclomatic 20) · ×1
  • PortfolioService._warnings (cyclomatic 20) agent/src/portfolio/service.py:1200 — PortfolioService._warnings 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 · claude_cli._decide (cyclomatic 20) · ×1
  • claude_cli._decide (cyclomatic 20) agent/src/providers/claude_cli.py:376 — claude_cli._decide 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 · claude_cli_models._query_claude_cli_models (cyclomatic 20) · ×1
  • claude_cli_models._query_claude_cli_models (cyclomatic 20) agent/src/providers/claude_cli_models.py:74 — claude_cli_models._query_claude_cli_models 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 · crossvalidation.group_purged_kfold_splits (cyclomatic 20) · ×1
  • crossvalidation.group_purged_kfold_splits (cyclomatic 20) agent/src/quantlib/crossvalidation.py:292 — crossvalidation.group_purged_kfold_splits 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 · factormodel.factor_risk_decomposition (cyclomatic 20) · ×1
  • factormodel.factor_risk_decomposition (cyclomatic 20) agent/src/quantlib/factormodel.py:601 — factormodel.factor_risk_decomposition 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 · factormodel.factor_ic_analysis (cyclomatic 20) · ×1
  • factormodel.factor_ic_analysis (cyclomatic 20) agent/src/quantlib/factormodel.py:761 — factormodel.factor_ic_analysis 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 · SignalEngine._find_impulse (cyclomatic 20) · ×1
  • SignalEngine._find_impulse (cyclomatic 20) agent/src/skills/elliott-wave/example_signal_engine.py:188 — SignalEngine._find_impulse 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 · presets.inspect_preset (cyclomatic 20) · ×1
  • presets.inspect_preset (cyclomatic 20) agent/src/swarm/presets.py:171 — presets.inspect_preset 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 · SwarmRuntime._execute_run (cyclomatic 20) · ×1
  • SwarmRuntime._execute_run (cyclomatic 20) agent/src/swarm/runtime.py:517 — SwarmRuntime._execute_run has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · alpha_bench_tool._load_csi300_panel (cyclomatic 20) · ×1
  • alpha_bench_tool._load_csi300_panel (cyclomatic 20) agent/src/tools/alpha_bench_tool.py:316 — alpha_bench_tool._load_csi300_panel 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 · GildataFundNavTool._fetch_one (cyclomatic 20) · ×1
  • GildataFundNavTool._fetch_one (cyclomatic 20) agent/src/tools/fund_nav_tool.py:220 — GildataFundNavTool._fetch_one 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 · southbound_tool._parse_hkex_report (cyclomatic 20) · ×1
  • southbound_tool._parse_hkex_report (cyclomatic 20) agent/src/tools/southbound_tool.py:174 — southbound_tool._parse_hkex_report 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 · trade_journal_parsers.parse_generic (cyclomatic 20) · ×1
  • trade_journal_parsers.parse_generic (cyclomatic 20) agent/src/tools/trade_journal_parsers.py:571 — trade_journal_parsers.parse_generic 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 · orders.place_order (cyclomatic 20) · ×1
  • orders.place_order (cyclomatic 20) agent/src/trading/connectors/mt5/orders.py:59 — orders.place_order 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 · GoalPanel.GoalPanel (cyclomatic 20) · ×1
  • GoalPanel.GoalPanel (cyclomatic 20) frontend/src/components/chat/GoalPanel.tsx:61 — GoalPanel.GoalPanel has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RunnerBudgetControls.RunnerBudgetControls (cyclomatic 20) · ×1
  • RunnerBudgetControls.RunnerBudgetControls (cyclomatic 20) frontend/src/components/chat/RunnerBudgetControls.tsx:6 — RunnerBudgetControls.RunnerBudgetControls has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PortfolioSourceEditor.PortfolioSourceEditor (cyclomatic 20) · ×1
  • PortfolioSourceEditor.PortfolioSourceEditor (cyclomatic 20) frontend/src/components/portfolio/PortfolioSourceEditor.tsx:29 — PortfolioSourceEditor.PortfolioSourceEditor has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 108, a function literal at line 35, move, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · RunDetail.ChartTab (cyclomatic 20) · ×1
  • RunDetail.ChartTab (cyclomatic 20) frontend/src/pages/RunDetail.tsx:825 — RunDetail.ChartTab has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · composite._build_rule_engines (cyclomatic 19) · ×1
  • composite._build_rule_engines (cyclomatic 19) agent/backtest/engines/composite.py:29 — composite._build_rule_engines 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 · DataLoader._request_page (cyclomatic 19) · ×1
  • DataLoader._request_page (cyclomatic 19) REDACTED:148 — DataLoader._request_page has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy.cmd_run (cyclomatic 19) · ×1
  • _legacy.cmd_run (cyclomatic 19) agent/cli/_legacy.py:1519 — _legacy.cmd_run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _legacy.cmd_swarm_inspect (cyclomatic 19) · ×1
  • _legacy.cmd_swarm_inspect (cyclomatic 19) agent/cli/_legacy.py:2714 — _legacy.cmd_swarm_inspect has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · research_playbook.run (cyclomatic 19) · ×1
  • research_playbook.run (cyclomatic 19) agent/cli/commands/research_playbook.py:398 — research_playbook.run has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · assertions._budget_verdicts (cyclomatic 19) · ×1
  • assertions._budget_verdicts (cyclomatic 19) agent/evals/harness/assertions.py:526 — assertions._budget_verdicts 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 · assertions._tool_result_join_verdict (cyclomatic 19) · ×1
  • assertions._tool_result_join_verdict (cyclomatic 19) agent/evals/harness/assertions.py:713 — assertions._tool_result_join_verdict 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 · _EvidenceMixin._record_backtest_outputs (cyclomatic 19) · ×1
  • _EvidenceMixin._record_backtest_outputs (cyclomatic 19) agent/src/agent/grounding/evidence.py:926 — _EvidenceMixin._record_backtest_outputs 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 · _EvidenceMixin._ingest_document_text (cyclomatic 19) · ×1
  • _EvidenceMixin._ingest_document_text (cyclomatic 19) agent/src/agent/grounding/evidence.py:1497 — _EvidenceMixin._ingest_document_text 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 · _PolicyMixin._operands_read_as_points (cyclomatic 19) · ×1
  • _PolicyMixin._operands_read_as_points (cyclomatic 19) agent/src/agent/grounding/policies.py:2063 — _PolicyMixin._operands_read_as_points 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 · result_artifacts.deliver_tool_result (cyclomatic 19) · ×1
  • result_artifacts.deliver_tool_result (cyclomatic 19) agent/src/agent/result_artifacts.py:60 — result_artifacts.deliver_tool_result has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MatrixChannel._handle_key_verification_event (cyclomatic 19) · ×1
  • MatrixChannel._handle_key_verification_event (cyclomatic 19) agent/src/channels/matrix.py:624 — MatrixChannel._handle_key_verification_event 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 · WeixinChannel._send_media_file (cyclomatic 19) · ×1
  • WeixinChannel._send_media_file (cyclomatic 19) REDACTED:1328 — WeixinChannel._send_media_file has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Runner.execute (cyclomatic 19) · ×1
  • Runner.execute (cyclomatic 19) REDACTED:594 — Runner.execute has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sdk_order_gate._recover_pending_order (cyclomatic 19) · ×1
  • sdk_order_gate._recover_pending_order (cyclomatic 19) agent/src/live/sdk_order_gate.py:542 — sdk_order_gate._recover_pending_order has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PersistentMemory.add (cyclomatic 19) · ×1
  • PersistentMemory.add (cyclomatic 19) agent/src/memory/persistent.py:515 — PersistentMemory.add 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 · rebalance.propose_rebalance (cyclomatic 19) · ×1
  • rebalance.propose_rebalance (cyclomatic 19) agent/src/portfolio/rebalance.py:13 — rebalance.propose_rebalance 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 · PortfolioService._combine_holdings (cyclomatic 19) · ×1
  • PortfolioService._combine_holdings (cyclomatic 19) agent/src/portfolio/service.py:897 — PortfolioService._combine_holdings 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 · openai_codex._get_codex_token (cyclomatic 19) · ×1
  • openai_codex._get_codex_token (cyclomatic 19) agent/src/providers/openai_codex.py:330 — openai_codex._get_codex_token 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 · scanner._compare (cyclomatic 19) · ×1
  • scanner._compare (cyclomatic 19) agent/src/shadow_account/scanner.py:236 — scanner._compare has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FredMacroTool.execute (cyclomatic 19) · ×1
  • FredMacroTool.execute (cyclomatic 19) agent/src/tools/fred_macro_tool.py:114 — FredMacroTool.execute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · goal_tool._trace_fields_from_runtime (cyclomatic 19) · ×1
  • goal_tool._trace_fields_from_runtime (cyclomatic 19) agent/src/tools/goal_tool.py:72 — goal_tool._trace_fields_from_runtime has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · OptionsPricingTool.execute (cyclomatic 19) · ×1
  • OptionsPricingTool.execute (cyclomatic 19) agent/src/tools/options_pricing_tool.py:95 — OptionsPricingTool.execute has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · schema._validate_node (cyclomatic 19) · ×1
  • schema._validate_node (cyclomatic 19) agent/src/tools/paper_trade/schema.py:619 — schema._validate_node 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 · session_5m.match_orders_5m (cyclomatic 19) · ×1
  • session_5m.match_orders_5m (cyclomatic 19) agent/src/tools/paper_trade/session_5m.py:66 — session_5m.match_orders_5m has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check_i18n.main (cyclomatic 19) · ×1
  • check_i18n.main (cyclomatic 19) wiki/scripts/check_i18n.py:68 — check_i18n.main has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update-verification.verifyWindowsUpdateCandidate (cyclomatic 19) · ×1
  • update-verification.verifyWindowsUpdateCandidate (cyclomatic 19) desktop/electron/src/update-verification.ts:51 — update-verification.verifyWindowsUpdateCandidate has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ScheduledResearchProposalCard.ScheduledResearchProposalCard (cyclomatic 19) · ×1
  • ScheduledResearchProposalCard.ScheduledResearchProposalCard (cyclomatic 19) frontend/src/components/chat/ScheduledResearchProposalCard.tsx:19 — ScheduledResearchProposalCard.ScheduledResearchProposalCard has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConnectionCenter.AccountSelector (cyclomatic 19) · ×1
  • ConnectionCenter.AccountSelector (cyclomatic 19) frontend/src/components/portfolio/ConnectionCenter.tsx:246 — ConnectionCenter.AccountSelector has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useAnalysisState.useAnalysisState (cyclomatic 19) · ×1
  • useAnalysisState.useAnalysisState (cyclomatic 19) frontend/src/hooks/useAnalysisState.ts:14 — useAnalysisState.useAnalysisState has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · binance_account_reconciliation.snapshot_from_binance_usdm_observation (cyclomatic 18) · ×1
  • binance_account_reconciliation.snapshot_from_binance_usdm_observation (cyclomatic 18) agent/backtest/binance_account_reconciliation.py:133 — binance_account_reconciliation.snapshot_from_binance_usdm_observation 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 · valuation_loader.load_valuation_panel (cyclomatic 18) · ×1
  • valuation_loader.load_valuation_panel (cyclomatic 18) agent/backtest/loaders/valuation_loader.py:229 — valuation_loader.load_valuation_panel has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_card._metric_citations (cyclomatic 18) · ×1
  • run_card._metric_citations (cyclomatic 18) agent/backtest/run_card.py:458 — run_card._metric_citations 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 · runner._reject_forbidden_open (cyclomatic 18) · ×1
  • runner._reject_forbidden_open (cyclomatic 18) agent/backtest/runner.py:557 — runner._reject_forbidden_open 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 · context_compact._context_collapse (cyclomatic 18) · ×1
  • context_compact._context_collapse (cyclomatic 18) agent/src/agent/context_compact.py:292 — context_compact._context_collapse 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 · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) · ×1
  • _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) agent/src/agent/grounding/evidence.py:1392 — _EvidenceMixin._ingest_run_dir_ohlc_csvs 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 · figures.table_rows (cyclomatic 18) · ×1
  • figures.table_rows (cyclomatic 18) agent/src/agent/grounding/figures.py:915 — figures.table_rows 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 · figures._currency_code_for_figure (cyclomatic 18) · ×1
  • figures._currency_code_for_figure (cyclomatic 18) agent/src/agent/grounding/figures.py:1027 — figures._currency_code_for_figure 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 · write_targets.pending_write_directive (cyclomatic 18) · ×1
  • write_targets.pending_write_directive (cyclomatic 18) agent/src/agent/write_targets.py:114 — write_targets.pending_write_directive 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 · attribution_core._attribution_equal_weight_returns (cyclomatic 18) · ×1
  • attribution_core._attribution_equal_weight_returns (cyclomatic 18) agent/src/api/attribution_core.py:279 — attribution_core._attribution_equal_weight_returns 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 · channels_config_routes._apply_update (cyclomatic 18) · ×1
  • channels_config_routes._apply_update (cyclomatic 18) agent/src/api/channels_config_routes.py:454 — channels_config_routes._apply_update 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 · runs_routes._build_positions_sector_map (cyclomatic 18) · ×1
  • runs_routes._build_positions_sector_map (cyclomatic 18) agent/src/api/runs_routes.py:530 — runs_routes._build_positions_sector_map 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 · feishu._extract_post_content (cyclomatic 18) · ×1
  • feishu._extract_post_content (cyclomatic 18) agent/src/channels/feishu.py:305 — feishu._extract_post_content 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 · ChannelManager._dispatch_outbound (cyclomatic 18) · ×1
  • ChannelManager._dispatch_outbound (cyclomatic 18) REDACTED:458 — ChannelManager._dispatch_outbound 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 · SignalChannel._sse_receive_loop (cyclomatic 18) · ×1
  • SignalChannel._sse_receive_loop (cyclomatic 18) REDACTED:609 — SignalChannel._sse_receive_loop has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TelegramChannel._process_message_update (cyclomatic 18) · ×1
  • TelegramChannel._process_message_update (cyclomatic 18) agent/src/channels/telegram.py:1462 — TelegramChannel._process_message_update 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 · MemoryLifecycle.run_gc (cyclomatic 18) · ×1
  • MemoryLifecycle.run_gc (cyclomatic 18) agent/src/memory/lifecycle.py:183 — MemoryLifecycle.run_gc 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 · tool_policy.check_bash_command (cyclomatic 18) · ×1
  • tool_policy.check_bash_command (cyclomatic 18) agent/src/providers/tool_policy.py:84 — tool_policy.check_bash_command 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 · attribution.brinson_fachler (cyclomatic 18) · ×1
  • attribution.brinson_fachler (cyclomatic 18) agent/src/quantlib/attribution.py:209 — attribution.brinson_fachler 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 · artifact._flatten (cyclomatic 18) · ×1
  • artifact._flatten (cyclomatic 18) agent/src/quantlib/valuation/artifact.py:399 — artifact._flatten 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 · playbooks.load_playbook_file (cyclomatic 18) · ×1
  • playbooks.load_playbook_file (cyclomatic 18) agent/src/scheduled_research/playbooks.py:275 — playbooks.load_playbook_file 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 · SessionService._run_attempt (cyclomatic 18) · ×1
  • SessionService._run_attempt (cyclomatic 18) agent/src/session/service.py:446 — SessionService._run_attempt 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 · adaptation_workflow.validate_adapted_run (cyclomatic 18) · ×1
  • adaptation_workflow.validate_adapted_run (cyclomatic 18) agent/src/strategy_discovery/adaptation_workflow.py:111 — adaptation_workflow.validate_adapted_run has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · backtest_tool.run_backtest (cyclomatic 18) · ×1
  • backtest_tool.run_backtest (cyclomatic 18) agent/src/tools/backtest_tool.py:193 — backtest_tool.run_backtest 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 · fund_flow_tool._fetch_symbol_flow (cyclomatic 18) · ×1
  • fund_flow_tool._fetch_symbol_flow (cyclomatic 18) agent/src/tools/fund_flow_tool.py:117 — fund_flow_tool._fetch_symbol_flow 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 · InstitutionalHoldingsTool._top_managers (cyclomatic 18) · ×1
  • InstitutionalHoldingsTool._top_managers (cyclomatic 18) agent/src/tools/institutional_holdings_tool.py:2158 — InstitutionalHoldingsTool._top_managers 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 · LoadSkillTool.execute (cyclomatic 18) · ×1
  • LoadSkillTool.execute (cyclomatic 18) agent/src/tools/load_skill_tool.py:207 — LoadSkillTool.execute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · instruments.search_instruments (cyclomatic 18) · ×1
  • instruments.search_instruments (cyclomatic 18) agent/src/trading/connectors/etoro/instruments.py:157 — instruments.search_instruments 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 · sdk.cancel_order (cyclomatic 18) · ×1
  • sdk.cancel_order (cyclomatic 18) agent/src/trading/connectors/kis/sdk.py:562 — sdk.cancel_order 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 · _client._usd_contract_value (cyclomatic 18) · ×1
  • _client._usd_contract_value (cyclomatic 18) REDACTED:385 — _client._usd_contract_value 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 · sdk.place_order (cyclomatic 18) · ×1
  • sdk.place_order (cyclomatic 18) agent/src/trading/connectors/okx/sdk.py:373 — sdk.place_order 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 · ui_services.infer_indicator_periods (cyclomatic 18) · ×1
  • ui_services.infer_indicator_periods (cyclomatic 18) agent/src/ui_services.py:151 — ui_services.infer_indicator_periods has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · build_alpha_library.main (cyclomatic 18) · ×1
  • build_alpha_library.main (cyclomatic 18) wiki/scripts/build_alpha_library.py:483 — build_alpha_library.main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MonthlyReturnsHeatmap.MonthlyReturnsHeatmap (cyclomatic 18) · ×1
  • MonthlyReturnsHeatmap.MonthlyReturnsHeatmap (cyclomatic 18) frontend/src/components/charts/MonthlyReturnsHeatmap.tsx:17 — MonthlyReturnsHeatmap.MonthlyReturnsHeatmap has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 20, 58, 95). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ActivityLine.ActivityLine (cyclomatic 18) · ×1
  • ActivityLine.ActivityLine (cyclomatic 18) frontend/src/components/chat/ActivityLine.tsx:62 — ActivityLine.ActivityLine has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ToolProgressIndicator.calculateEta (cyclomatic 18) · ×1
  • ToolProgressIndicator.calculateEta (cyclomatic 18) frontend/src/components/chat/ToolProgressIndicator.tsx:15 — ToolProgressIndicator.calculateEta has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ConfirmDialog.ConfirmDialog (cyclomatic 18) · ×1
  • ConfirmDialog.ConfirmDialog (cyclomatic 18) frontend/src/components/common/ConfirmDialog.tsx:25 — ConfirmDialog.ConfirmDialog has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 48, 42, 78). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SidebarNavigation.SidebarNavigation (cyclomatic 18) · ×1
  • SidebarNavigation.SidebarNavigation (cyclomatic 18) frontend/src/components/layout/SidebarNavigation.tsx:8 — SidebarNavigation.SidebarNavigation has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 44, 40, 20, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · tearsheet.computeMonthlyReturns (cyclomatic 18) · ×1
  • tearsheet.computeMonthlyReturns (cyclomatic 18) frontend/src/lib/tearsheet.ts:106 — tearsheet.computeMonthlyReturns 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 · AlphaZoo.CompareView (cyclomatic 18) · ×1
  • AlphaZoo.CompareView (cyclomatic 18) frontend/src/pages/AlphaZoo.tsx:1027 — AlphaZoo.CompareView has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Portfolio.AccountCard (cyclomatic 18) · ×1
  • Portfolio.AccountCard (cyclomatic 18) frontend/src/pages/Portfolio.tsx:547 — Portfolio.AccountCard has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loader_health.check_frame (cyclomatic 17) · ×1
  • loader_health.check_frame (cyclomatic 17) agent/backtest/loader_health.py:147 — loader_health.check_frame 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 · fundamentals_loader._extract_concept_series (cyclomatic 17) · ×1
  • fundamentals_loader._extract_concept_series (cyclomatic 17) agent/backtest/loaders/fundamentals_loader.py:48 — fundamentals_loader._extract_concept_series 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 · FutuLoader.fetch (cyclomatic 17) · ×1
  • FutuLoader.fetch (cyclomatic 17) agent/backtest/loaders/futu.py:148 — FutuLoader.fetch 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 · mt5_loader._ensure_initialized (cyclomatic 17) · ×1
  • mt5_loader._ensure_initialized (cyclomatic 17) agent/backtest/loaders/mt5_loader.py:76 — mt5_loader._ensure_initialized 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 · runner._ast_config_keys (cyclomatic 17) · ×1
  • runner._ast_config_keys (cyclomatic 17) agent/backtest/runner.py:1312 — runner._ast_config_keys 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 · runner.main (cyclomatic 17) · ×1
  • runner.main (cyclomatic 17) agent/backtest/runner.py:1433 — runner.main has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _legacy._handle_swarm_command (cyclomatic 17) · ×1
  • _legacy._handle_swarm_command (cyclomatic 17) agent/cli/_legacy.py:2009 — _legacy._handle_swarm_command 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 · context_compact._fix_tool_pairs (cyclomatic 17) · ×1
  • context_compact._fix_tool_pairs (cyclomatic 17) agent/src/agent/context_compact.py:394 — context_compact._fix_tool_pairs 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 · policies._records_at (cyclomatic 17) · ×1
  • policies._records_at (cyclomatic 17) agent/src/agent/grounding/policies.py:2595 — policies._records_at 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 · settings_routes._list_provider_models (cyclomatic 17) · ×1
  • settings_routes._list_provider_models (cyclomatic 17) agent/src/api/settings_routes.py:411 — settings_routes._list_provider_models 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 · settings_routes._build_llm_settings_response (cyclomatic 17) · ×1
  • settings_routes._build_llm_settings_response (cyclomatic 17) agent/src/api/settings_routes.py:510 — settings_routes._build_llm_settings_response 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 · EmailChannel._extract_text_body (cyclomatic 17) · ×1
  • EmailChannel._extract_text_body (cyclomatic 17) agent/src/channels/email.py:919 — EmailChannel._extract_text_body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EmailChannel._check_authentication_results (cyclomatic 17) · ×1
  • EmailChannel._check_authentication_results (cyclomatic 17) agent/src/channels/email.py:1095 — EmailChannel._check_authentication_results 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 · NapcatChannel._parse_segments (cyclomatic 17) · ×1
  • NapcatChannel._parse_segments (cyclomatic 17) agent/src/channels/napcat.py:309 — NapcatChannel._parse_segments 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 · QQChannel._on_message (cyclomatic 17) · ×1
  • QQChannel._on_message (cyclomatic 17) agent/src/channels/qq.py:531 — QQChannel._on_message 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 · WebSocketChannel._save_envelope_media (cyclomatic 17) · ×1
  • WebSocketChannel._save_envelope_media (cyclomatic 17) REDACTED:604 — WebSocketChannel._save_envelope_media 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 · WeixinChannel._qr_login (cyclomatic 17) · ×1
  • WeixinChannel._qr_login (cyclomatic 17) REDACTED:342 — WeixinChannel._qr_login 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 · whatsapp._media_message (cyclomatic 17) · ×1
  • whatsapp._media_message (cyclomatic 17) agent/src/channels/whatsapp.py:215 — whatsapp._media_message has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · data_availability.build_availability_contract (cyclomatic 17) · ×1
  • data_availability.build_availability_contract (cyclomatic 17) agent/src/factors/data_availability.py:229 — data_availability.build_availability_contract has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Registry.compute (cyclomatic 17) · ×1
  • Registry.compute (cyclomatic 17) agent/src/factors/registry.py:325 — Registry.compute 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 · PersistentMemory.remove (cyclomatic 17) · ×1
  • PersistentMemory.remove (cyclomatic 17) agent/src/memory/persistent.py:649 — PersistentMemory.remove 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 · compatibility.adapt_and_validate_payloads (cyclomatic 17) · ×1
  • compatibility.adapt_and_validate_payloads (cyclomatic 17) agent/src/portfolio/compatibility.py:131 — compatibility.adapt_and_validate_payloads 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 · PortfolioImportStore.create (cyclomatic 17) · ×1
  • PortfolioImportStore.create (cyclomatic 17) agent/src/portfolio/imports.py:46 — PortfolioImportStore.create 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 · normalization.account_total_usd (cyclomatic 17) · ×1
  • normalization.account_total_usd (cyclomatic 17) agent/src/portfolio/normalization.py:248 — normalization.account_total_usd 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 · PortfolioStore.history (cyclomatic 17) · ×1
  • PortfolioStore.history (cyclomatic 17) agent/src/portfolio/store.py:143 — PortfolioStore.history 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 · fixedincome.fit_yield_curve (cyclomatic 17) · ×1
  • fixedincome.fit_yield_curve (cyclomatic 17) agent/src/quantlib/fixedincome.py:733 — fixedincome.fit_yield_curve 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 · SignalEngine.generate (cyclomatic 17) · ×1
  • SignalEngine.generate (cyclomatic 17) agent/src/skills/multi-factor/example_signal_engine.py:94 — SignalEngine.generate 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 · _ShortPremium._run (cyclomatic 17) · ×1
  • _ShortPremium._run (cyclomatic 17) agent/src/skills/options-strategy/example_signal_engine.py:123 — _ShortPremium._run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sec_filings_example.recent_filings (cyclomatic 17) · ×1
  • sec_filings_example.recent_filings (cyclomatic 17) agent/src/skills/sec-edgar/scripts/sec_filings_example.py:47 — sec_filings_example.recent_filings 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 · SwarmRuntime._execute_layer (cyclomatic 17) · ×1
  • SwarmRuntime._execute_layer (cyclomatic 17) agent/src/swarm/runtime.py:972 — SwarmRuntime._execute_layer has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worker._classify_deliverable (cyclomatic 17) · ×1
  • worker._classify_deliverable (cyclomatic 17) agent/src/swarm/worker.py:1433 — worker._classify_deliverable 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 · BackgroundManager._execute (cyclomatic 17) · ×1
  • BackgroundManager._execute (cyclomatic 17) agent/src/tools/background_tools.py:280 — BackgroundManager._execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · backtest_runs_tool.list_backtest_runs (cyclomatic 17) · ×1
  • backtest_runs_tool.list_backtest_runs (cyclomatic 17) agent/src/tools/backtest_runs_tool.py:133 — backtest_runs_tool.list_backtest_runs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · backtest_tool._record_bench_if_declared (cyclomatic 17) · ×1
  • backtest_tool._record_bench_if_declared (cyclomatic 17) agent/src/tools/backtest_tool.py:106 — backtest_tool._record_bench_if_declared 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 · financial_statements_tool._fetch_yahoo_statement (cyclomatic 17) · ×1
  • financial_statements_tool._fetch_yahoo_statement (cyclomatic 17) agent/src/tools/financial_statements_tool.py:332 — financial_statements_tool._fetch_yahoo_statement 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 · institutional_holdings_tool._parse_information_table (cyclomatic 17) · ×1
  • institutional_holdings_tool._parse_information_table (cyclomatic 17) agent/src/tools/institutional_holdings_tool.py:721 — institutional_holdings_tool._parse_information_table has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · quantlib_tool._encode (cyclomatic 17) · ×1
  • quantlib_tool._encode (cyclomatic 17) agent/src/tools/quantlib_tool.py:182 — quantlib_tool._encode 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 · SdmDecayScanTool.execute (cyclomatic 17) · ×1
  • SdmDecayScanTool.execute (cyclomatic 17) agent/src/tools/sdm_decay_scan_tool.py:64 — SdmDecayScanTool.execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sec_filings_tool._parse_filings (cyclomatic 17) · ×1
  • sec_filings_tool._parse_filings (cyclomatic 17) agent/src/tools/sec_filings_tool.py:185 — sec_filings_tool._parse_filings has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SwarmTool.execute (cyclomatic 17) · ×1
  • SwarmTool.execute (cyclomatic 17) agent/src/tools/swarm_tool.py:536 — SwarmTool.execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · technical_indicator_tool._extract_series (cyclomatic 17) · ×1
  • technical_indicator_tool._extract_series (cyclomatic 17) agent/src/tools/technical_indicator_tool.py:47 — technical_indicator_tool._extract_series 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 · trade_journal_parsers._infer_market_from_symbol (cyclomatic 17) · ×1
  • trade_journal_parsers._infer_market_from_symbol (cyclomatic 17) agent/src/tools/trade_journal_parsers.py:694 — trade_journal_parsers._infer_market_from_symbol 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 · usdm._join_positions (cyclomatic 17) · ×1
  • usdm._join_positions (cyclomatic 17) agent/src/trading/connectors/binance/usdm.py:144 — usdm._join_positions 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 · sdk.place_order (cyclomatic 17) · ×1
  • sdk.place_order (cyclomatic 17) agent/src/trading/connectors/dhan/sdk.py:439 — sdk.place_order 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 · EtoroClient.request (cyclomatic 17) · ×1
  • EtoroClient.request (cyclomatic 17) agent/src/trading/connectors/etoro/client.py:280 — EtoroClient.request 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 · service._sdk_config (cyclomatic 17) · ×1
  • service._sdk_config (cyclomatic 17) agent/src/trading/service.py:81 — service._sdk_config 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 · Layout.LanguageSwitcher (cyclomatic 17) · ×1
  • Layout.LanguageSwitcher (cyclomatic 17) frontend/src/components/layout/Layout.tsx:393 — Layout.LanguageSwitcher has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · correlation.infer_market (cyclomatic 16) · ×1
  • correlation.infer_market (cyclomatic 16) agent/backtest/correlation.py:20 — correlation.infer_market has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ArgentinaEquityEngine.prepare_market_data (cyclomatic 16) · ×1
  • ArgentinaEquityEngine.prepare_market_data (cyclomatic 16) agent/backtest/engines/argentina_equity.py:469 — ArgentinaEquityEngine.prepare_market_data 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 · fmp_loader._parse_historical (cyclomatic 16) · ×1
  • fmp_loader._parse_historical (cyclomatic 16) agent/backtest/loaders/fmp_loader.py:220 — fmp_loader._parse_historical has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DataLoader._fetch_one (cyclomatic 16) · ×1
  • DataLoader._fetch_one (cyclomatic 16) REDACTED:230 — DataLoader._fetch_one 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 · metrics.win_rate_and_stats (cyclomatic 16) · ×1
  • metrics.win_rate_and_stats (cyclomatic 16) agent/backtest/metrics.py:343 — metrics.win_rate_and_stats has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnoverAwareOptimizer.__init__ (cyclomatic 16) · ×1
  • TurnoverAwareOptimizer.__init__ (cyclomatic 16) agent/backtest/optimizers/turnover_aware.py:52 — TurnoverAwareOptimizer.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · options_payoff._analytic_breakevens (cyclomatic 16) · ×1
  • options_payoff._analytic_breakevens (cyclomatic 16) agent/backtest/options_payoff.py:203 — options_payoff._analytic_breakevens 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 · validation.walk_forward_analysis (cyclomatic 16) · ×1
  • validation.walk_forward_analysis (cyclomatic 16) agent/backtest/validation.py:232 — validation.walk_forward_analysis has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main._render_mandate_proposal (cyclomatic 16) · ×1
  • main._render_mandate_proposal (cyclomatic 16) agent/cli/main.py:1000 — main._render_mandate_proposal 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 · assertions._tool_verdicts (cyclomatic 16) · ×1
  • assertions._tool_verdicts (cyclomatic 16) agent/evals/harness/assertions.py:259 — assertions._tool_verdicts 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 · HarnessCase.from_dict (cyclomatic 16) · ×1
  • HarnessCase.from_dict (cyclomatic 16) agent/evals/harness/schema.py:33 — HarnessCase.from_dict has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · evidence._metric_kind_for_path (cyclomatic 16) · ×1
  • evidence._metric_kind_for_path (cyclomatic 16) agent/src/agent/grounding/evidence.py:593 — evidence._metric_kind_for_path 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 · figures._writes_decimal_commas (cyclomatic 16) · ×1
  • figures._writes_decimal_commas (cyclomatic 16) agent/src/agent/grounding/figures.py:578 — figures._writes_decimal_commas has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · _IdentityMixin.authorize_tool_call (cyclomatic 16) · ×1
  • _IdentityMixin.authorize_tool_call (cyclomatic 16) agent/src/agent/grounding/identity.py:454 — _IdentityMixin.authorize_tool_call has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) · ×1
  • _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) agent/src/agent/grounding/policies.py:1310 — _PolicyMixin._unknown_call_field_ref_candidates has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · llm_usage._normalize_llm_usage (cyclomatic 16) · ×1
  • llm_usage._normalize_llm_usage (cyclomatic 16) agent/src/agent/llm_usage.py:35 — llm_usage._normalize_llm_usage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runs_routes._iter_factor_series_files (cyclomatic 16) · ×1
  • runs_routes._iter_factor_series_files (cyclomatic 16) agent/src/api/runs_routes.py:222 — runs_routes._iter_factor_series_files 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 · FeishuChannel._format_tool_hint_lines (cyclomatic 16) · ×1
  • FeishuChannel._format_tool_hint_lines (cyclomatic 16) agent/src/channels/feishu.py:2442 — FeishuChannel._format_tool_hint_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 · MatrixChannel._download_media_bytes (cyclomatic 16) · ×1
  • MatrixChannel._download_media_bytes (cyclomatic 16) agent/src/channels/matrix.py:873 — MatrixChannel._download_media_bytes has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MSTeamsChannel._prune_conversation_refs (cyclomatic 16) · ×1
  • MSTeamsChannel._prune_conversation_refs (cyclomatic 16) agent/src/channels/msteams.py:727 — MSTeamsChannel._prune_conversation_refs 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 · NapcatChannel._on_message (cyclomatic 16) · ×1
  • NapcatChannel._on_message (cyclomatic 16) agent/src/channels/napcat.py:233 — NapcatChannel._on_message 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 · QQChannel._read_media_bytes (cyclomatic 16) · ×1
  • QQChannel._read_media_bytes (cyclomatic 16) agent/src/channels/qq.py:408 — QQChannel._read_media_bytes has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SignalChannel._check_inbound_policy (cyclomatic 16) · ×1
  • SignalChannel._check_inbound_policy (cyclomatic 16) REDACTED:839 — SignalChannel._check_inbound_policy 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 · SlackChannel._on_block_action (cyclomatic 16) · ×1
  • SlackChannel._on_block_action (cyclomatic 16) agent/src/channels/slack.py:535 — SlackChannel._on_block_action has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · compare_runner.compare_alphas (cyclomatic 16) · ×1
  • compare_runner.compare_alphas (cyclomatic 16) agent/src/factors/compare_runner.py:88 — compare_runner.compare_alphas has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · data_availability._source_for (cyclomatic 16) · ×1
  • data_availability._source_for (cyclomatic 16) agent/src/factors/data_availability.py:170 — data_availability._source_for 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 · GoalStore._validate_completion_audit (cyclomatic 16) · ×1
  • GoalStore._validate_completion_audit (cyclomatic 16) agent/src/goal/store.py:899 — GoalStore._validate_completion_audit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cli_handlers._emit_detail (cyclomatic 16) · ×1
  • cli_handlers._emit_detail (cyclomatic 16) agent/src/hypotheses/cli_handlers.py:105 — cli_handlers._emit_detail has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · LiveRunner._run_preemptive_sweep (cyclomatic 16) · ×1
  • LiveRunner._run_preemptive_sweep (cyclomatic 16) agent/src/live/runtime/runner.py:624 — LiveRunner._run_preemptive_sweep has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sdk_order_gate._recover_correlated_fill (cyclomatic 16) · ×1
  • sdk_order_gate._recover_correlated_fill (cyclomatic 16) agent/src/live/sdk_order_gate.py:620 — sdk_order_gate._recover_correlated_fill has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · extraetf._parse_decimal (cyclomatic 16) · ×1
  • extraetf._parse_decimal (cyclomatic 16) agent/src/portfolio/extraetf.py:787 — extraetf._parse_decimal has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PortfolioService.latest (cyclomatic 16) · ×1
  • PortfolioService.latest (cyclomatic 16) agent/src/portfolio/service.py:564 — PortfolioService.latest 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 · preflight._check_llm_provider (cyclomatic 16) · ×1
  • preflight._check_llm_provider (cyclomatic 16) agent/src/preflight.py:32 — preflight._check_llm_provider has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · microstructure.vpin (cyclomatic 16) · ×1
  • microstructure.vpin (cyclomatic 16) agent/src/quantlib/microstructure.py:132 — microstructure.vpin 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 · SignalEngine._find_abc (cyclomatic 16) · ×1
  • SignalEngine._find_abc (cyclomatic 16) agent/src/skills/elliott-wave/example_signal_engine.py:285 — SignalEngine._find_abc 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 · _StockPlusOption._run (cyclomatic 16) · ×1
  • _StockPlusOption._run (cyclomatic 16) agent/src/skills/options-strategy/example_signal_engine.py:268 — _StockPlusOption._run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SwarmRuntime._apply_resume_overlay (cyclomatic 16) · ×1
  • SwarmRuntime._apply_resume_overlay (cyclomatic 16) agent/src/swarm/runtime.py:782 — SwarmRuntime._apply_resume_overlay 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 · financial_statements_tool._synthesize_fiscal_q4 (cyclomatic 16) · ×1
  • financial_statements_tool._synthesize_fiscal_q4 (cyclomatic 16) agent/src/tools/financial_statements_tool.py:575 — financial_statements_tool._synthesize_fiscal_q4 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 · data_5m._split_session_days (cyclomatic 16) · ×1
  • data_5m._split_session_days (cyclomatic 16) agent/src/tools/paper_trade/data_5m.py:326 — data_5m._split_session_days 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 · redaction.is_sensitive_arg (cyclomatic 16) · ×1
  • redaction.is_sensitive_arg (cyclomatic 16) agent/src/tools/redaction.py:284 — redaction.is_sensitive_arg has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ReportAuditTool.execute (cyclomatic 16) · ×1
  • ReportAuditTool.execute (cyclomatic 16) agent/src/tools/report_audit_tool.py:561 — ReportAuditTool.execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · report_audit_tool._parse_md_tables (cyclomatic 16) · ×1
  • report_audit_tool._parse_md_tables (cyclomatic 16) agent/src/tools/report_audit_tool.py:147 — report_audit_tool._parse_md_tables 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 · research_papers_tool._arxiv_search (cyclomatic 16) · ×1
  • research_papers_tool._arxiv_search (cyclomatic 16) agent/src/tools/research_papers_tool.py:1109 — research_papers_tool._arxiv_search has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · research_papers_tool._openalex_search (cyclomatic 16) · ×1
  • research_papers_tool._openalex_search (cyclomatic 16) agent/src/tools/research_papers_tool.py:1315 — research_papers_tool._openalex_search has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · run_artifact_tool.read_run_artifact (cyclomatic 16) · ×1
  • run_artifact_tool.read_run_artifact (cyclomatic 16) agent/src/tools/run_artifact_tool.py:450 — run_artifact_tool.read_run_artifact has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · trade_journal_tool.analyze_trade_journal (cyclomatic 16) · ×1
  • trade_journal_tool.analyze_trade_journal (cyclomatic 16) agent/src/tools/trade_journal_tool.py:675 — trade_journal_tool.analyze_trade_journal has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BinanceConfig.from_mapping (cyclomatic 16) · ×1
  • BinanceConfig.from_mapping (cyclomatic 16) agent/src/trading/connectors/binance/sdk.py:75 — BinanceConfig.from_mapping has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · sdk._enrich_positions_with_metadata (cyclomatic 16) · ×1
  • sdk._enrich_positions_with_metadata (cyclomatic 16) agent/src/trading/connectors/etoro/sdk.py:422 — sdk._enrich_positions_with_metadata has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · trading.place_order (cyclomatic 16) · ×1
  • trading.place_order (cyclomatic 16) agent/src/trading/connectors/etoro/trading.py:32 — trading.place_order has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sdk._request (cyclomatic 16) · ×1
  • sdk._request (cyclomatic 16) agent/src/trading/connectors/kis/sdk.py:814 — sdk._request has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sdk.place_order (cyclomatic 16) · ×1
  • sdk.place_order (cyclomatic 16) agent/src/trading/connectors/shoonya/sdk.py:421 — sdk.place_order has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · service._call_remote (cyclomatic 16) · ×1
  • service._call_remote (cyclomatic 16) agent/src/trading/service.py:1516 — service._call_remote has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sync_site_chrome.wiring_problems (cyclomatic 16) · ×1
  • sync_site_chrome.wiring_problems (cyclomatic 16) wiki/scripts/sync_site_chrome.py:121 — sync_site_chrome.wiring_problems 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 · StrategyResearchDashboard.getStrategyReportIdentity (cyclomatic 16) · ×1
  • StrategyResearchDashboard.getStrategyReportIdentity (cyclomatic 16) frontend/src/components/charts/StrategyResearchDashboard.tsx:69 — StrategyResearchDashboard.getStrategyReportIdentity has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MessageBubble.MessageBubble (cyclomatic 16) · ×1
  • MessageBubble.MessageBubble (cyclomatic 16) frontend/src/components/chat/MessageBubble.tsx:204 — MessageBubble.MessageBubble has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · api.errorFromResponse (cyclomatic 16) · ×1
  • api.errorFromResponse (cyclomatic 16) frontend/src/lib/api.ts:401 — api.errorFromResponse 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 · PixelOffice.PixelOffice (cyclomatic 16) · ×1
  • PixelOffice.PixelOffice (cyclomatic 16) frontend/src/pages/PixelOffice.tsx:6 — PixelOffice.PixelOffice has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 21, a function literal at line 16, mutate, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · Runtime.BrokerRuntimeCard (cyclomatic 16) · ×1
  • Runtime.BrokerRuntimeCard (cyclomatic 16) frontend/src/pages/Runtime.tsx:227 — Runtime.BrokerRuntimeCard has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · translateElement (cyclomatic 16) · ×1
  • translateElement (cyclomatic 16) wiki/site.js:62 — translateElement 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 · Agent.Agent (cognitive 427) · ×1
  • Agent.Agent (cognitive 427) frontend/src/pages/Agent.tsx:233 — Agent.Agent has cognitive complexity 427 (threshold 15). Drivers by points: if/else 161 (196 pts), boolean chains 123, ternaries 50 (91 pts), error handling 7 (9 pts), loops 8 (nesting depth added 78). Of this number, 21 points are the body's own statements and 406 belong to 75 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentLoop._run_bound (cognitive 194) · ×1
  • AgentLoop._run_bound (cognitive 194) REDACTED:387 — AgentLoop._run_bound has cognitive complexity 194 (threshold 15). Drivers by points: if/else 54 (123 pts), boolean chains 34, ternaries 13 (29 pts), error handling 3 (7 pts), loops 1 (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options_portfolio.run_options_backtest (cognitive 150) · ×1
  • options_portfolio.run_options_backtest (cognitive 150) agent/backtest/engines/options_portfolio.py:199 — options_portfolio.run_options_backtest has cognitive complexity 150 (threshold 15). Drivers by points: if/else 28 (86 pts), ternaries 11 (41 pts), loops 11 (19 pts), boolean chains 4 (nesting depth added 96). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WeixinChannel._process_message (cognitive 143) · ×1
  • WeixinChannel._process_message (cognitive 143) REDACTED:600 — WeixinChannel._process_message has cognitive complexity 143 (threshold 15). Drivers by points: if/else 47 (121 pts), boolean chains 18, loops 3 (4 pts) (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Scheduled.Scheduled (cognitive 116) · ×1
  • Scheduled.Scheduled (cognitive 116) frontend/src/pages/Scheduled.tsx:92 — Scheduled.Scheduled has cognitive complexity 116 (threshold 15). Drivers by points: ternaries 26 (44 pts), boolean chains 40, if/else 26 (27 pts), error handling 3, match/switch 2 (nesting depth added 19). Of this number, 38 points are the body's own statements and 78 belong to 19 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Portfolio.Portfolio (cognitive 114) · ×1
  • Portfolio.Portfolio (cognitive 114) frontend/src/pages/Portfolio.tsx:135 — Portfolio.Portfolio has cognitive complexity 114 (threshold 15). Drivers by points: ternaries 39 (73 pts), if/else 14 (18 pts), boolean chains 16, error handling 6, loops 1 (nesting depth added 38). Of this number, 41 points are the body's own statements and 73 belong to 16 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine._execute_bars (cognitive 106) · ×1
  • BaseEngine._execute_bars (cognitive 106) agent/backtest/engines/base.py:1255 — BaseEngine._execute_bars has cognitive complexity 106 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 9 (20 pts), ternaries 6 (18 pts), boolean chains 10, error handling 2 (7 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner.fetch_data_map (cognitive 94) · ×1
  • runner.fetch_data_map (cognitive 94) agent/backtest/runner.py:2017 — runner.fetch_data_map has cognitive complexity 94 (threshold 15). Drivers by points: if/else 24 (61 pts), loops 5 (18 pts), boolean chains 13, ternaries 1 (2 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · feishu._extract_element_content (cognitive 93) · ×1
  • feishu._extract_element_content (cognitive 93) agent/src/channels/feishu.py:204 — feishu._extract_element_content has cognitive complexity 93 (threshold 15). Drivers by points: if/else 23 (62 pts), loops 7 (18 pts), ternaries 2 (7 pts), boolean chains 6 (nesting depth added 55). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · bench_runner.run_bench (cognitive 84) · ×1
  • bench_runner.run_bench (cognitive 84) agent/src/factors/bench_runner.py:144 — bench_runner.run_bench has cognitive complexity 84 (threshold 15). Drivers by points: if/else 24 (39 pts), error handling 10 (24 pts), loops 5 (8 pts), ternaries 4 (7 pts), boolean chains 6 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioService._collect_source (cognitive 83) · ×1
  • PortfolioService._collect_source (cognitive 83) agent/src/portfolio/service.py:960 — PortfolioService._collect_source has cognitive complexity 83 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 20, ternaries 4 (12 pts), error handling 2 (4 pts), loops 3 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · worker._run_worker_impl (cognitive 83) · ×1
  • worker._run_worker_impl (cognitive 83) agent/src/swarm/worker.py:612 — worker._run_worker_impl has cognitive complexity 83 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 19, ternaries 4 (10 pts), error handling 3 (5 pts), loops 2 (3 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schema._validate_expectations (cognitive 77) · ×1
  • schema._validate_expectations (cognitive 77) agent/evals/harness/schema.py:79 — schema._validate_expectations has cognitive complexity 77 (threshold 15). Drivers by points: if/else 25 (55 pts), loops 6 (12 pts), boolean chains 10 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options_portfolio._calc_options_metrics (cognitive 76) · ×1
  • options_portfolio._calc_options_metrics (cognitive 76) agent/backtest/engines/options_portfolio.py:703 — options_portfolio._calc_options_metrics has cognitive complexity 76 (threshold 15). Drivers by points: if/else 37 (49 pts), ternaries 11 (12 pts), boolean chains 10, error handling 2 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RunnerStatus.BrokerRow (cognitive 75) · ×1
  • RunnerStatus.BrokerRow (cognitive 75) frontend/src/components/chat/RunnerStatus.tsx:121 — RunnerStatus.BrokerRow has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 17 (56 pts), boolean chains 12, if/else 6, error handling 1 (nesting depth added 39). Of this number, 65 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TelegramChannel.send_delta (cognitive 72) · ×1
  • TelegramChannel.send_delta (cognitive 72) agent/src/channels/telegram.py:937 — TelegramChannel.send_delta has cognitive complexity 72 (threshold 15). Drivers by points: if/else 21 (44 pts), error handling 6 (17 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · main._interactive_loop (cognitive 70) · ×1
  • main._interactive_loop (cognitive 70) agent/cli/main.py:1295 — main._interactive_loop has cognitive complexity 70 (threshold 15). Drivers by points: if/else 23 (52 pts), error handling 5 (11 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (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 · ChannelSettings.ChannelSettings (cognitive 69) · ×1
  • ChannelSettings.ChannelSettings (cognitive 69) frontend/src/components/settings/ChannelSettings.tsx:24 — ChannelSettings.ChannelSettings has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 23 (49 pts), if/else 11, boolean chains 6, error handling 3 (nesting depth added 26). Most of this is not in the body itself: 15 of the 69 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 235, a function literal at line 38, setChannelsRunning, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ChatLLM.stream_chat (cognitive 68) · ×1
  • ChatLLM.stream_chat (cognitive 68) agent/src/providers/chat.py:480 — ChatLLM.stream_chat has cognitive complexity 68 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 17, ternaries 6 (12 pts), error handling 2, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai_codex._message_chunks_from_events (cognitive 67) · ×1
  • openai_codex._message_chunks_from_events (cognitive 67) agent/src/providers/openai_codex.py:632 — openai_codex._message_chunks_from_events has cognitive complexity 67 (threshold 15). Drivers by points: if/else 12 (41 pts), boolean chains 21, ternaries 1 (4 pts), loops 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RunDetail.RunDetail (cognitive 67) · ×1
  • RunDetail.RunDetail (cognitive 67) frontend/src/pages/RunDetail.tsx:124 — RunDetail.RunDetail has cognitive complexity 67 (threshold 15). Drivers by points: boolean chains 30, if/else 18 (20 pts), ternaries 11 (16 pts), loops 1 (nesting depth added 7). Of this number, 27 points are the body's own statements and 40 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _legacy.main (cognitive 66) · ×1
  • _legacy.main (cognitive 66) agent/cli/_legacy.py:6742 — _legacy.main has cognitive complexity 66 (threshold 15). Drivers by points: if/else 52 (61 pts), ternaries 2 (3 pts), boolean chains 1, error handling 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PersistentMemory.find_relevant (cognitive 66) · ×1
  • PersistentMemory.find_relevant (cognitive 66) agent/src/memory/persistent.py:366 — PersistentMemory.find_relevant has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 5 (11 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · tools.build_registry (cognitive 65) · ×1
  • tools.build_registry (cognitive 65) agent/src/tools/__init__.py:77 — tools.build_registry has cognitive complexity 65 (threshold 15). Drivers by points: if/else 15 (37 pts), ternaries 3 (10 pts), loops 4 (7 pts), boolean chains 6, error handling 2 (5 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · trade_journal_parsers._futu_datetime (cognitive 65) · ×1
  • trade_journal_parsers._futu_datetime (cognitive 65) agent/src/tools/trade_journal_parsers.py:473 — trade_journal_parsers._futu_datetime has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (39 pts), boolean chains 15, error handling 2 (6 pts), ternaries 3 (5 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · WebSearchTool.execute (cognitive 65) · ×1
  • WebSearchTool.execute (cognitive 65) agent/src/tools/web_search_tool.py:173 — WebSearchTool.execute has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (32 pts), error handling 8 (16 pts), boolean chains 8, ternaries 4 (6 pts), loops 2 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eventstudy.event_study (cognitive 64) · ×1
  • eventstudy.event_study (cognitive 64) agent/src/quantlib/eventstudy.py:325 — eventstudy.event_study has cognitive complexity 64 (threshold 15). Drivers by points: if/else 28 (37 pts), ternaries 10 (17 pts), loops 4 (5 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine._execute_target_rebalance (cognitive 63) · ×1
  • BaseEngine._execute_target_rebalance (cognitive 63) agent/backtest/engines/base.py:1763 — BaseEngine._execute_target_rebalance has cognitive complexity 63 (threshold 15). Drivers by points: if/else 21 (49 pts), loops 4 (6 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures.scan_figures (cognitive 63) · ×1
  • figures.scan_figures (cognitive 63) agent/src/agent/grounding/figures.py:1224 — figures.scan_figures has cognitive complexity 63 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 20, ternaries 6 (13 pts), loops 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._check_observed (cognitive 62) · ×1
  • _PolicyMixin._check_observed (cognitive 62) agent/src/agent/grounding/policies.py:1643 — _PolicyMixin._check_observed has cognitive complexity 62 (threshold 15). Drivers by points: if/else 26 (47 pts), ternaries 5 (8 pts), boolean chains 7 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ingest._load_panel_long (cognitive 62) · ×1
  • ingest._load_panel_long (cognitive 62) agent/src/entities/ingest.py:928 — ingest._load_panel_long has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (46 pts), boolean chains 10, error handling 2 (4 pts), loops 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._derivation (cognitive 61) · ×1
  • _PolicyMixin._derivation (cognitive 61) agent/src/agent/grounding/policies.py:1888 — _PolicyMixin._derivation has cognitive complexity 61 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 22, ternaries 4 (7 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 · bench_runner_strict.run_bench_strict (cognitive 61) · ×1
  • bench_runner_strict.run_bench_strict (cognitive 61) agent/src/factors/bench_runner_strict.py:319 — bench_runner_strict.run_bench_strict has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (27 pts), ternaries 8 (11 pts), error handling 6 (10 pts), boolean chains 9, loops 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options.barrier_option_price (cognitive 61) · ×1
  • options.barrier_option_price (cognitive 61) agent/src/quantlib/options.py:517 — options.barrier_option_price has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 14 (34 pts), if/else 17 (22 pts), boolean chains 5 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · telegram._split_telegram_markdown (cognitive 60) · ×1
  • telegram._split_telegram_markdown (cognitive 60) agent/src/channels/telegram.py:46 — telegram._split_telegram_markdown has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (52 pts), ternaries 1 (6 pts), boolean chains 1, loops 1 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · cli_handlers.cmd_alpha_bench (cognitive 60) · ×1
  • cli_handlers.cmd_alpha_bench (cognitive 60) agent/src/factors/cli_handlers.py:566 — cli_handlers.cmd_alpha_bench has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (35 pts), ternaries 8 (12 pts), boolean chains 7, error handling 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WecomChannel._process_message (cognitive 59) · ×1
  • WecomChannel._process_message (cognitive 59) REDACTED:223 — WecomChannel._process_message has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (45 pts), boolean chains 8, loops 2 (3 pts), ternaries 2, error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OptionsLab.OptionsLab (cognitive 59) · ×1
  • OptionsLab.OptionsLab (cognitive 59) frontend/src/pages/OptionsLab.tsx:58 — OptionsLab.OptionsLab has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 20 (36 pts), boolean chains 16, if/else 5 (6 pts), error handling 1 (nesting depth added 17). Of this number, 45 points are the body's own statements and 14 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._validate_figures (cognitive 58) · ×1
  • _PolicyMixin._validate_figures (cognitive 58) agent/src/agent/grounding/policies.py:457 — _PolicyMixin._validate_figures has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (36 pts), ternaries 4 (12 pts), boolean chains 8, loops 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel._fetch_messages_once (cognitive 58) · ×1
  • EmailChannel._fetch_messages_once (cognitive 58) agent/src/channels/email.py:537 — EmailChannel._fetch_messages_once has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._referenced (cognitive 57) · ×1
  • _PolicyMixin._referenced (cognitive 57) agent/src/agent/grounding/policies.py:789 — _PolicyMixin._referenced has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 18, ternaries 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · feishu._extract_interactive_content (cognitive 57) · ×1
  • feishu._extract_interactive_content (cognitive 57) agent/src/channels/feishu.py:133 — feishu._extract_interactive_content has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (32 pts), loops 4 (14 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp.quote_summary (cognitive 57) · ×1
  • mcp.quote_summary (cognitive 57) agent/src/trading/connectors/robinhood/mcp.py:352 — mcp.quote_summary has cognitive complexity 57 (threshold 15). Drivers by points: if/else 28 (42 pts), boolean chains 7, loops 2 (4 pts), error handling 1 (3 pts), ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_connector_check (cognitive 56) · ×1
  • _legacy.cmd_connector_check (cognitive 56) agent/cli/_legacy.py:4468 — _legacy.cmd_connector_check has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 7 (23 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · trade_journal_tool.pair_trades_fifo (cognitive 56) · ×1
  • trade_journal_tool.pair_trades_fifo (cognitive 56) agent/src/tools/trade_journal_tool.py:76 — trade_journal_tool.pair_trades_fifo has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 8 (28 pts), if/else 6 (16 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VibeTradingDingTalkHandler.process (cognitive 55) · ×1
  • VibeTradingDingTalkHandler.process (cognitive 55) agent/src/channels/dingtalk.py:57 — VibeTradingDingTalkHandler.process has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 15, ternaries 1 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel.send (cognitive 54) · ×1
  • EmailChannel.send (cognitive 54) agent/src/channels/email.py:265 — EmailChannel.send has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 13, error handling 3 (5 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report_audit_tool._parse_md_tables (cognitive 54) · ×1
  • report_audit_tool._parse_md_tables (cognitive 54) agent/src/tools/report_audit_tool.py:147 — report_audit_tool._parse_md_tables has cognitive complexity 54 (threshold 15). Drivers by points: if/else 7 (34 pts), loops 3 (10 pts), ternaries 1 (6 pts), boolean chains 4 (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · rail._result_summary (cognitive 53) · ×1
  • rail._result_summary (cognitive 53) agent/cli/ui/rail.py:125 — rail._result_summary has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 6, ternaries 2 (6 pts), error handling 2 (5 pts), loops 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Layout.Layout (cognitive 53) · ×1
  • Layout.Layout (cognitive 53) frontend/src/components/layout/Layout.tsx:21 — Layout.Layout has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 17 (25 pts), boolean chains 16, if/else 10, error handling 2 (nesting depth added 8). Of this number, 30 points are the body's own statements and 23 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RailRunDashboard.handle_event (cognitive 52) · ×1
  • RailRunDashboard.handle_event (cognitive 52) agent/cli/ui/rail.py:320 — RailRunDashboard.handle_event has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 15, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _IdentityMixin._ingest_resolution (cognitive 52) · ×1
  • _IdentityMixin._ingest_resolution (cognitive 52) agent/src/agent/grounding/identity.py:704 — _IdentityMixin._ingest_resolution has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 14, ternaries 6 (7 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebSocketChannel.send (cognitive 52) · ×1
  • WebSocketChannel.send (cognitive 52) REDACTED:884 — WebSocketChannel.send has cognitive complexity 52 (threshold 15). Drivers by points: if/else 22 (31 pts), ternaries 7 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · symbol_search_tool._search_selected_connector (cognitive 52) · ×1
  • symbol_search_tool._search_selected_connector (cognitive 52) agent/src/tools/symbol_search_tool.py:546 — symbol_search_tool._search_selected_connector has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 15, ternaries 6 (13 pts), loops 2 (3 pts), error handling 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loop_grounding.validate_and_release (cognitive 51) · ×1
  • loop_grounding.validate_and_release (cognitive 51) agent/src/agent/loop_grounding.py:30 — loop_grounding.validate_and_release has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ToolCallLifecycle._process_tool_calls (cognitive 51) · ×1
  • ToolCallLifecycle._process_tool_calls (cognitive 51) agent/src/agent/tool_lifecycle.py:49 — ToolCallLifecycle._process_tool_calls has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 6 (13 pts), boolean chains 7, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebSocketChannel._dispatch_envelope (cognitive 50) · ×1
  • WebSocketChannel._dispatch_envelope (cognitive 50) REDACTED:672 — WebSocketChannel._dispatch_envelope has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (40 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runs_routes._build_response_from_run_dir (cognitive 49) · ×1
  • runs_routes._build_response_from_run_dir (cognitive 49) agent/src/api/runs_routes.py:680 — runs_routes._build_response_from_run_dir has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 10, error handling 3 (6 pts), ternaries 2 (6 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · service.build_job_from_draft (cognitive 49) · ×1
  • service.build_job_from_draft (cognitive 49) agent/src/scheduled_research/service.py:136 — service.build_job_from_draft has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (29 pts), boolean chains 19, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · runner._fetch_auto (cognitive 48) · ×1
  • runner._fetch_auto (cognitive 48) agent/backtest/runner.py:1901 — runner._fetch_auto has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 5 (12 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cli_handlers.cmd_alpha_show (cognitive 48) · ×1
  • cli_handlers.cmd_alpha_show (cognitive 48) agent/src/factors/cli_handlers.py:302 — cli_handlers.cmd_alpha_show has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 11 (18 pts), boolean chains 11, if/else 10 (11 pts), error handling 4 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarmStatus.applySwarmEvent (cognitive 48) · ×1
  • swarmStatus.applySwarmEvent (cognitive 48) frontend/src/lib/swarmStatus.ts:209 — swarmStatus.applySwarmEvent has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (17 pts), ternaries 8 (16 pts), boolean chains 15 (nesting depth added 9). Of this number, 23 points are the body's own statements and 25 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentLoop._auto_compact (cognitive 47) · ×1
  • AgentLoop._auto_compact (cognitive 47) REDACTED:1521 — AgentLoop._auto_compact has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 10, error handling 1 (3 pts), loops 2, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ingest.load_cashflows (cognitive 46) · ×1
  • ingest.load_cashflows (cognitive 46) agent/src/entities/ingest.py:365 — ingest.load_cashflows has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 7, error handling 2 (4 pts), 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.
D2 · Cognitive Complexity · config.parse_settings (cognitive 46) · ×1
  • config.parse_settings (cognitive 46) agent/src/portfolio/config.py:144 — config.parse_settings has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 11, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PaperTrading.PaperTrading (cognitive 46) · ×1
  • PaperTrading.PaperTrading (cognitive 46) frontend/src/pages/PaperTrading.tsx:18 — PaperTrading.PaperTrading has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 13 (25 pts), if/else 7 (9 pts), boolean chains 8, error handling 3 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 15 of the 46 points are its own statements and the rest belongs to 15 function items inside it that branch (advance, a function literal at line 44, a function literal at line 47, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · metrics.calc_metrics (cognitive 45) · ×1
  • metrics.calc_metrics (cognitive 45) agent/backtest/metrics.py:563 — metrics.calc_metrics has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 12 (17 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioService.refresh (cognitive 45) · ×1
  • PortfolioService.refresh (cognitive 45) agent/src/portfolio/service.py:301 — PortfolioService.refresh has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 4 (8 pts), error handling 3 (7 pts), boolean chains 4, loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionCenter.ConnectionCard (cognitive 45) · ×1
  • ConnectionCenter.ConnectionCard (cognitive 45) frontend/src/components/portfolio/ConnectionCenter.tsx:169 — ConnectionCenter.ConnectionCard has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 19 (28 pts), boolean chains 12, if/else 3, error handling 2 (nesting depth added 9). Of this number, 26 points are the body's own statements and 19 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · argentina_equity._field_problems (cognitive 44) · ×1
  • argentina_equity._field_problems (cognitive 44) agent/backtest/engines/argentina_equity.py:872 — argentina_equity._field_problems has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 10, ternaries 2 (6 pts), error handling 2 (5 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tushare_fundamentals.enrich_price_frames_with_fundamentals (cognitive 44) · ×1
  • tushare_fundamentals.enrich_price_frames_with_fundamentals (cognitive 44) agent/backtest/loaders/tushare_fundamentals.py:311 — tushare_fundamentals.enrich_price_frames_with_fundamentals has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel._on_message (cognitive 44) · ×1
  • FeishuChannel._on_message (cognitive 44) agent/src/channels/feishu.py:2261 — FeishuChannel._on_message has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 7, ternaries 4, loops 2 (3 pts), error handling 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CandlestickChart.CandlestickChart (cognitive 44) · ×1
  • CandlestickChart.CandlestickChart (cognitive 44) frontend/src/components/charts/CandlestickChart.tsx:37 — CandlestickChart.CandlestickChart has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 10 (14 pts), boolean chains 8, loops 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 44 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 222, 114, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChannelConfigPanel.ChannelConfigPanel (cognitive 44) · ×1
  • ChannelConfigPanel.ChannelConfigPanel (cognitive 44) frontend/src/components/settings/ChannelConfigPanel.tsx:193 — ChannelConfigPanel.ChannelConfigPanel has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 51 (77 pts), if/else 29 (38 pts), boolean chains 25, loops 4, error handling 3 (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. This shape REPEATS in the file: one other method here (ChannelConfigPanel.ChannelConfigPanel::renderField) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · figures.parse_figures_block (cognitive 43) · ×1
  • figures.parse_figures_block (cognitive 43) agent/src/agent/grounding/figures.py:791 — figures.parse_figures_block has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 9 (18 pts), loops 2 (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.
D2 · Cognitive Complexity · FeishuChannel.send_delta (cognitive 43) · ×1
  • FeishuChannel.send_delta (cognitive 43) agent/src/channels/feishu.py:1881 — FeishuChannel.send_delta has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (37 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackChannel._on_socket_request (cognitive 43) · ×1
  • SlackChannel._on_socket_request (cognitive 43) agent/src/channels/slack.py:335 — SlackChannel._on_socket_request has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 15, error handling 2, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · llm.build_llm (cognitive 43) · ×1
  • llm.build_llm (cognitive 43) agent/src/providers/llm.py:1645 — llm.build_llm has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 12, ternaries 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalEngine._find_impulse (cognitive 43) · ×1
  • SignalEngine._find_impulse (cognitive 43) agent/src/skills/elliott-wave/example_signal_engine.py:188 — SignalEngine._find_impulse has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (38 pts), boolean chains 4, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _RunDashboard.handle_event (cognitive 42) · ×1
  • _RunDashboard.handle_event (cognitive 42) agent/cli/_legacy.py:604 — _RunDashboard.handle_event has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 11, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_engine_table (cognitive 42) · ×1
  • _EvidenceMixin._ingest_engine_table (cognitive 42) agent/src/agent/grounding/evidence.py:1056 — _EvidenceMixin._ingest_engine_table has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 6, ternaries 2 (4 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WeixinChannel.send (cognitive 42) · ×1
  • WeixinChannel.send (cognitive 42) REDACTED:1090 — WeixinChannel.send has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 10, error handling 4 (7 pts), ternaries 2 (7 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalization.normalize_position (cognitive 42) · ×1
  • normalization.normalize_position (cognitive 42) agent/src/portfolio/normalization.py:56 — normalization.normalize_position has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 21, ternaries 12 (16 pts), if/else 5 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · tool._execute_step (cognitive 42) · ×1
  • tool._execute_step (cognitive 42) agent/src/tools/paper_trade/tool.py:229 — tool._execute_step has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 8, ternaries 4 (7 pts), error handling 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourcePrioritySettings.SourcePrioritySettings (cognitive 42) · ×1
  • SourcePrioritySettings.SourcePrioritySettings (cognitive 42) frontend/src/components/settings/SourcePrioritySettings.tsx:24 — SourcePrioritySettings.SourcePrioritySettings has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 14 (28 pts), boolean chains 7, if/else 6, error handling 1 (nesting depth added 14). Of this number, 23 points are the body's own statements and 19 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runs_routes._scan_factor_results (cognitive 41) · ×1
  • runs_routes._scan_factor_results (cognitive 41) agent/src/api/runs_routes.py:288 — runs_routes._scan_factor_results has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (33 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 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.
D2 · Cognitive Complexity · DingTalkChannel._fetch_remote_media_bytes (cognitive 41) · ×1
  • DingTalkChannel._fetch_remote_media_bytes (cognitive 41) agent/src/channels/dingtalk.py:384 — DingTalkChannel._fetch_remote_media_bytes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 3 (6 pts), boolean chains 2, error handling 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramChannel.send (cognitive 41) · ×1
  • TelegramChannel.send (cognitive 41) agent/src/channels/telegram.py:750 — TelegramChannel.send has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 6, ternaries 2 (5 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etf_holdings_tool._holdings_cn (cognitive 41) · ×1
  • etf_holdings_tool._holdings_cn (cognitive 41) agent/src/tools/etf_holdings_tool.py:1490 — etf_holdings_tool._holdings_cn has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · financial_statements_tool._fetch_sec_statement (cognitive 41) · ×1
  • financial_statements_tool._fetch_sec_statement (cognitive 41) agent/src/tools/financial_statements_tool.py:683 — financial_statements_tool._fetch_sec_statement has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 3 (7 pts), loops 3 (4 pts), boolean chains 2, error handling 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Compare.Compare (cognitive 41) · ×1
  • Compare.Compare (cognitive 41) frontend/src/pages/Compare.tsx:235 — Compare.Compare has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 23, if/else 12, ternaries 4 (6 pts) (nesting depth added 2). Of this number, 19 points are the body's own statements and 22 belong to 14 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · _legacy._print_result (cognitive 40) · ×1
  • _legacy._print_result (cognitive 40) agent/cli/_legacy.py:1411 — _legacy._print_result has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (27 pts), ternaries 4 (8 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_connector_positions (cognitive 40) · ×1
  • _legacy.cmd_connector_positions (cognitive 40) agent/cli/_legacy.py:5033 — _legacy.cmd_connector_positions has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 12, ternaries 4 (9 pts), loops 2 (4 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel.send (cognitive 40) · ×1
  • FeishuChannel.send (cognitive 40) agent/src/channels/feishu.py:2037 — FeishuChannel.send has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 4, loops 2 (4 pts), error handling 1, ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · commit._resolve_profile (cognitive 40) · ×1
  • commit._resolve_profile (cognitive 40) agent/src/live/mandate/commit.py:265 — commit._resolve_profile has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (33 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · market_data.fetch_market_data (cognitive 40) · ×1
  • market_data.fetch_market_data (cognitive 40) agent/src/market_data.py:199 — market_data.fetch_market_data has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 4 (6 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StrategyDiscoveryFacade.query_strategies (cognitive 40) · ×1
  • StrategyDiscoveryFacade.query_strategies (cognitive 40) agent/src/strategy_discovery/facade.py:417 — StrategyDiscoveryFacade.query_strategies has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 8, error handling 4 (6 pts), loops 4, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstitutionalHoldingsTool._ticker_holders (cognitive 40) · ×1
  • InstitutionalHoldingsTool._ticker_holders (cognitive 40) agent/src/tools/institutional_holdings_tool.py:1998 — InstitutionalHoldingsTool._ticker_holders has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 11, loops 4 (7 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadFileTool.execute (cognitive 40) · ×1
  • ReadFileTool.execute (cognitive 40) agent/src/tools/read_file_tool.py:107 — ReadFileTool.execute has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (23 pts), error handling 4 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PositionsTab.PositionsTab (cognitive 40) · ×1
  • PositionsTab.PositionsTab (cognitive 40) frontend/src/components/run/PositionsTab.tsx:97 — PositionsTab.PositionsTab has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 8 (10 pts), boolean chains 7, loops 4 (7 pts), error handling 1 (nesting depth added 11). Most of this is not in the body itself: 5 of the 40 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 174, handleResolve, a function literal at line 160, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · CustomProviderManager.CustomProviderManager (cognitive 40) · ×1
  • CustomProviderManager.CustomProviderManager (cognitive 40) frontend/src/components/settings/CustomProviderManager.tsx:20 — CustomProviderManager.CustomProviderManager has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 17 (25 pts), boolean chains 9, error handling 3, if/else 3 (nesting depth added 8). Of this number, 16 points are the body's own statements and 24 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_card._model_provenance (cognitive 39) · ×1
  • run_card._model_provenance (cognitive 39) agent/backtest/run_card.py:47 — run_card._model_provenance has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 5 (8 pts), boolean chains 6, error handling 4 (6 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_card._render_markdown (cognitive 39) · ×1
  • run_card._render_markdown (cognitive 39) agent/backtest/run_card.py:510 — run_card._render_markdown has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (27 pts), loops 5 (8 pts), boolean chains 2, ternaries 2 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _PolicyMixin._indexed_field_ref_candidates (cognitive 39) · ×1
  • _PolicyMixin._indexed_field_ref_candidates (cognitive 39) agent/src/agent/grounding/policies.py:1188 — _PolicyMixin._indexed_field_ref_candidates has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 7, loops 2 (3 pts), ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings_routes._list_openai_codex_models (cognitive 39) · ×1
  • settings_routes._list_openai_codex_models (cognitive 39) agent/src/api/settings_routes.py:330 — settings_routes._list_openai_codex_models has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (4 pts), error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WhatsAppChannel._handle_neonize_message (cognitive 39) · ×1
  • WhatsAppChannel._handle_neonize_message (cognitive 39) agent/src/channels/whatsapp.py:503 — WhatsAppChannel._handle_neonize_message has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 16, loops 1 (2 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ingest._load_panel_wide (cognitive 39) · ×1
  • ingest._load_panel_wide (cognitive 39) agent/src/entities/ingest.py:1099 — ingest._load_panel_wide has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 4 (10 pts), error handling 3 (9 pts), loops 3 (5 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 · portfolio.hierarchical_risk_parity (cognitive 39) · ×1
  • portfolio.hierarchical_risk_parity (cognitive 39) agent/src/quantlib/portfolio.py:102 — portfolio.hierarchical_risk_parity has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScheduledResearchJob.from_dict (cognitive 39) · ×1
  • ScheduledResearchJob.from_dict (cognitive 39) agent/src/scheduled_research/models.py:313 — ScheduledResearchJob.from_dict has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 16, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · alpha_bench_tool.run_alpha_bench (cognitive 39) · ×1
  • alpha_bench_tool.run_alpha_bench (cognitive 39) agent/src/tools/alpha_bench_tool.py:1268 — alpha_bench_tool.run_alpha_bench has cognitive complexity 39 (threshold 15). Drivers by points: error handling 12 (15 pts), if/else 12 (14 pts), boolean chains 6, ternaries 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etf_holdings_tool._parse_cn_period (cognitive 39) · ×1
  • etf_holdings_tool._parse_cn_period (cognitive 39) agent/src/tools/etf_holdings_tool.py:891 — etf_holdings_tool._parse_cn_period has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 8 (13 pts), boolean chains 6, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_5m.match_orders_5m (cognitive 39) · ×1
  • session_5m.match_orders_5m (cognitive 39) agent/src/tools/paper_trade/session_5m.py:66 — session_5m.match_orders_5m has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 6 (11 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ui_services.load_run_context (cognitive 39) · ×1
  • ui_services.load_run_context (cognitive 39) agent/src/ui_services.py:102 — ui_services.load_run_context has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 14, loops 1 (4 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · runner._reject_forbidden_node (cognitive 38) · ×1
  • runner._reject_forbidden_node (cognitive 38) agent/backtest/runner.py:659 — runner._reject_forbidden_node has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3 (7 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._print_connector_account (cognitive 38) · ×1
  • _legacy._print_connector_account (cognitive 38) agent/cli/_legacy.py:4939 — _legacy._print_connector_account has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (14 pts), ternaries 2 (6 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.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_market_data (cognitive 38) · ×1
  • _EvidenceMixin._ingest_market_data (cognitive 38) agent/src/agent/grounding/evidence.py:1211 — _EvidenceMixin._ingest_market_data has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 5 (9 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolCallLifecycle._finalize_tool_result (cognitive 38) · ×1
  • ToolCallLifecycle._finalize_tool_result (cognitive 38) agent/src/agent/tool_lifecycle.py:796 — ToolCallLifecycle._finalize_tool_result has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 3 (7 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · claude_cli._decide (cognitive 38) · ×1
  • claude_cli._decide (cognitive 38) agent/src/providers/claude_cli.py:376 — claude_cli._decide has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (9 pts), ternaries 3 (6 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FinancialRigorTool.execute (cognitive 38) · ×1
  • FinancialRigorTool.execute (cognitive 38) agent/src/tools/financial_rigor_tool.py:549 — FinancialRigorTool.execute has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 8, loops 2 (4 pts), ternaries 2 (4 pts), error handling 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Runtime.Runtime (cognitive 38) · ×1
  • Runtime.Runtime (cognitive 38) frontend/src/pages/Runtime.tsx:25 — Runtime.Runtime has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 13 (22 pts), if/else 6 (8 pts), boolean chains 7, error handling 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Settings.Settings (cognitive 38) · ×1
  • Settings.Settings (cognitive 38) frontend/src/pages/Settings.tsx:41 — Settings.Settings has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 38 (50 pts), if/else 26 (30 pts), boolean chains 29, error handling 3 (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (Settings.Settings::submit, Settings.Settings::submitDataSources) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cognitive 37) · ×1
  • _EvidenceMixin._ingest_run_dir_ohlc_csvs (cognitive 37) agent/src/agent/grounding/evidence.py:1392 — _EvidenceMixin._ingest_run_dir_ohlc_csvs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (6 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelRuntime._handle_inbound (cognitive 37) · ×1
  • ChannelRuntime._handle_inbound (cognitive 37) agent/src/channels/runtime.py:122 — ChannelRuntime._handle_inbound has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 5 (9 pts), boolean chains 8, error handling 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk_order_gate._allow (cognitive 37) · ×1
  • sdk_order_gate._allow (cognitive 37) agent/src/live/sdk_order_gate.py:434 — sdk_order_gate._allow has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 5 (10 pts), error handling 4 (8 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalEngine.generate (cognitive 37) · ×1
  • SignalEngine.generate (cognitive 37) agent/src/skills/multi-factor/example_signal_engine.py:94 — SignalEngine.generate has cognitive complexity 37 (threshold 15). Drivers by points: loops 8 (17 pts), if/else 7 (16 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evidence_harness.compute_evidence_for_run (cognitive 37) · ×1
  • evidence_harness.compute_evidence_for_run (cognitive 37) agent/src/strategy_discovery/evidence_harness.py:411 — evidence_harness.compute_evidence_for_run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 5, ternaries 2 (3 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etf_holdings_tool._cn_etf_list (cognitive 37) · ×1
  • etf_holdings_tool._cn_etf_list (cognitive 37) agent/src/tools/etf_holdings_tool.py:1201 — etf_holdings_tool._cn_etf_list has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 4 (9 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TechnicalIndicatorTool.execute (cognitive 37) · ×1
  • TechnicalIndicatorTool.execute (cognitive 37) agent/src/tools/technical_indicator_tool.py:322 — TechnicalIndicatorTool.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 10, ternaries 6, error handling 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MandateProposalCard.MandateProposalCard (cognitive 37) · ×1
  • MandateProposalCard.MandateProposalCard (cognitive 37) frontend/src/components/chat/MandateProposalCard.tsx:203 — MandateProposalCard.MandateProposalCard has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 18, ternaries 9 (12 pts), if/else 6, error handling 1 (nesting depth added 3). Of this number, 23 points are the body's own statements and 14 belong to 7 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AlphaZoo.BrowseView (cognitive 37) · ×1
  • AlphaZoo.BrowseView (cognitive 37) frontend/src/pages/AlphaZoo.tsx:143 — AlphaZoo.BrowseView has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 15, if/else 3, loops 2 (3 pts) (nesting depth added 4). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 197, 386, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · identity._normalize_symbol (cognitive 36) · ×1
  • identity._normalize_symbol (cognitive 36) agent/src/agent/grounding/identity.py:164 — identity._normalize_symbol has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WeixinChannel._qr_login (cognitive 36) · ×1
  • WeixinChannel._qr_login (cognitive 36) REDACTED:342 — WeixinChannel._qr_login has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (30 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai_codex._convert_messages (cognitive 36) · ×1
  • openai_codex._convert_messages (cognitive 36) agent/src/providers/openai_codex.py:466 — openai_codex._convert_messages has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 7, ternaries 2 (6 pts), loops 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScheduledResearchExecutor.sweep_deliveries (cognitive 36) · ×1
  • ScheduledResearchExecutor.sweep_deliveries (cognitive 36) agent/src/scheduled_research/executor.py:567 — ScheduledResearchExecutor.sweep_deliveries has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (27 pts), error handling 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResearchPapersTool.execute (cognitive 36) · ×1
  • ResearchPapersTool.execute (cognitive 36) agent/src/tools/research_papers_tool.py:1557 — ResearchPapersTool.execute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 10, error handling 2 (3 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · southbound_tool._parse_hkex_report (cognitive 36) · ×1
  • southbound_tool._parse_hkex_report (cognitive 36) agent/src/tools/southbound_tool.py:174 — southbound_tool._parse_hkex_report has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (10 pts), ternaries 3 (7 pts), boolean chains 5, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 36) · ×1
  • sdk.place_order (cognitive 36) agent/src/trading/connectors/alpaca/sdk.py:460 — sdk.place_order has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, error handling 4 (5 pts), ternaries 5 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · update-verification.compareSemanticVersions (cognitive 36) · ×1
  • update-verification.compareSemanticVersions (cognitive 36) desktop/electron/src/update-verification.ts:229 — update-verification.compareSemanticVersions has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 4 (12 pts), boolean chains 3, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useAlphaJob.useAlphaJob.connect (cognitive 36) · ×1
  • useAlphaJob.useAlphaJob.connect (cognitive 36) frontend/src/hooks/useAlphaJob.ts:19 — useAlphaJob.useAlphaJob.connect has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 9 (10 pts), boolean chains 4, error handling 4 (nesting depth added 11). Most of this is not in the body itself: 10 of the 36 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 60, 50, 37, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · _EvidenceMixin._record_backtest_metrics (cognitive 35) · ×1
  • _EvidenceMixin._record_backtest_metrics (cognitive 35) agent/src/agent/grounding/evidence.py:856 — _EvidenceMixin._record_backtest_metrics has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (7 pts), boolean chains 6, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroundingLedger.ingest_tool_result (cognitive 35) · ×1
  • GroundingLedger.ingest_tool_result (cognitive 35) agent/src/agent/grounding/ledger.py:280 — GroundingLedger.ingest_tool_result has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7, ternaries 2 (7 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._prepare_sandbox_home (cognitive 35) · ×1
  • runner._prepare_sandbox_home (cognitive 35) REDACTED:181 — runner._prepare_sandbox_home has cognitive complexity 35 (threshold 15). Drivers by points: error handling 6 (15 pts), if/else 7 (15 pts), loops 1 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cli_handlers.cmd_alpha_list (cognitive 35) · ×1
  • cli_handlers.cmd_alpha_list (cognitive 35) agent/src/factors/cli_handlers.py:188 — cli_handlers.cmd_alpha_list has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 11, loops 3 (6 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalEngine._find_abc (cognitive 35) · ×1
  • SignalEngine._find_abc (cognitive 35) agent/src/skills/elliott-wave/example_signal_engine.py:285 — SignalEngine._find_abc has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (32 pts), boolean chains 2, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · example_signal_engine._detect_patterns_pyharmonics (cognitive 35) · ×1
  • example_signal_engine._detect_patterns_pyharmonics (cognitive 35) agent/src/skills/harmonic/example_signal_engine.py:249 — example_signal_engine._detect_patterns_pyharmonics has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 2 (8 pts), loops 3 (6 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · formatters.metricSentiment (cognitive 35) · ×1
  • formatters.metricSentiment (cognitive 35) frontend/src/lib/formatters.ts:69 — formatters.metricSentiment has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 12 (28 pts), if/else 6, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._artifact_scope (cognitive 34) · ×1
  • _PolicyMixin._artifact_scope (cognitive 34) agent/src/agent/grounding/policies.py:1022 — _PolicyMixin._artifact_scope has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 11, ternaries 2 (5 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attribution_core._build_attribution_payload (cognitive 34) · ×1
  • attribution_core._build_attribution_payload (cognitive 34) agent/src/api/attribution_core.py:767 — attribution_core._build_attribution_payload has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 10, ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelManager._dispatch_outbound (cognitive 34) · ×1
  • ChannelManager._dispatch_outbound (cognitive 34) REDACTED:458 — ChannelManager._dispatch_outbound has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, error handling 2 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · combination.combine_factors (cognitive 34) · ×1
  • combination.combine_factors (cognitive 34) agent/src/quantlib/combination.py:316 — combination.combine_factors has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 6, boolean chains 5, loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · neutralization.pca_factors (cognitive 34) · ×1
  • neutralization.pca_factors (cognitive 34) agent/src/quantlib/neutralization.py:385 — neutralization.pca_factors has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 4 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _StockPlusOption._run (cognitive 34) · ×1
  • _StockPlusOption._run (cognitive 34) agent/src/skills/options-strategy/example_signal_engine.py:268 — _StockPlusOption._run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionStore._parse (cognitive 34) · ×1
  • ConnectionStore._parse (cognitive 34) agent/src/trading/connections.py:356 — ConnectionStore._parse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 13, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OptionsChainTable.OptionsChainTable (cognitive 34) · ×1
  • OptionsChainTable.OptionsChainTable (cognitive 34) frontend/src/components/options/OptionsChainTable.tsx:139 — OptionsChainTable.OptionsChainTable has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 11, if/else 7 (8 pts), error handling 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelConfigPanel.ChannelConfigPanel · ×1
  • ChannelConfigPanel.ChannelConfigPanel::renderField (cognitive 34) frontend/src/components/settings/ChannelConfigPanel.tsx:534 — ChannelConfigPanel.ChannelConfigPanel::renderField has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 18 (27 pts), boolean chains 4, if/else 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ChannelConfigPanel.ChannelConfigPanel) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · binance_shadow_evidence._validate_evidence (cognitive 33) · ×1
  • binance_shadow_evidence._validate_evidence (cognitive 33) agent/backtest/binance_shadow_evidence.py:262 — binance_shadow_evidence._validate_evidence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 7, loops 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · valuation_loader.load_valuation_panel (cognitive 33) · ×1
  • valuation_loader.load_valuation_panel (cognitive 33) agent/backtest/loaders/valuation_loader.py:229 — valuation_loader.load_valuation_panel has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (7 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnoverAwareOptimizer._calc_weights (cognitive 33) · ×1
  • TurnoverAwareOptimizer._calc_weights (cognitive 33) agent/backtest/optimizers/turnover_aware.py:160 — TurnoverAwareOptimizer._calc_weights has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._print_portfolio_snapshot (cognitive 33) · ×1
  • _legacy._print_portfolio_snapshot (cognitive 33) agent/cli/_legacy.py:4200 — _legacy._print_portfolio_snapshot has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 16, ternaries 5 (9 pts), if/else 2 (4 pts), loops 4 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · _legacy.cmd_connector_setup (cognitive 33) · ×1
  • _legacy.cmd_connector_setup (cognitive 33) agent/cli/_legacy.py:4555 — _legacy.cmd_connector_setup has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, ternaries 2 (4 pts), loops 2 (3 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · write_targets.pending_write_directive (cognitive 33) · ×1
  • write_targets.pending_write_directive (cognitive 33) agent/src/agent/write_targets.py:114 — write_targets.pending_write_directive has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 2 (7 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel.start (cognitive 33) · ×1
  • EmailChannel.start (cognitive 33) agent/src/channels/email.py:171 — EmailChannel.start has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7, error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MSTeamsChannel._normalize_teams_reply_quote (cognitive 33) · ×1
  • MSTeamsChannel._normalize_teams_reply_quote (cognitive 33) agent/src/channels/msteams.py:441 — MSTeamsChannel._normalize_teams_reply_quote has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryLifecycle.run_gc (cognitive 33) · ×1
  • MemoryLifecycle.run_gc (cognitive 33) agent/src/memory/lifecycle.py:183 — MemoryLifecycle.run_gc has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stream_guard.supervised_pulls (cognitive 33) · ×1
  • stream_guard.supervised_pulls (cognitive 33) agent/src/providers/stream_guard.py:131 — stream_guard.supervised_pulls has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (8 pts), boolean chains 7, error handling 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResearchArtifactStore.save (cognitive 33) · ×1
  • ResearchArtifactStore.save (cognitive 33) agent/src/research_artifacts/store.py:180 — ResearchArtifactStore.save has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (9 pts), ternaries 5 (9 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 · SignalEngine._evaluate_signals (cognitive 33) · ×1
  • SignalEngine._evaluate_signals (cognitive 33) agent/src/skills/chanlun/example_signal_engine.py:134 — SignalEngine._evaluate_signals has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_artifacts.read_trade_activity (cognitive 33) · ×1
  • run_artifacts.read_trade_activity (cognitive 33) agent/src/strategy_discovery/run_artifacts.py:128 — run_artifacts.read_trade_activity has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 5 (9 pts), boolean chains 6, loops 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GildataFundNavTool._fetch_one (cognitive 33) · ×1
  • GildataFundNavTool._fetch_one (cognitive 33) agent/src/tools/fund_nav_tool.py:220 — GildataFundNavTool._fetch_one has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · institutional_holdings_tool._walk_chain (cognitive 33) · ×1
  • institutional_holdings_tool._walk_chain (cognitive 33) agent/src/tools/institutional_holdings_tool.py:1207 — institutional_holdings_tool._walk_chain has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 33) · ×1
  • sdk.place_order (cognitive 33) agent/src/trading/connectors/tiger/sdk.py:335 — sdk.place_order has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 9, error handling 5 (6 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · agent.useAgentStore (cognitive 33) · ×1
  • agent.useAgentStore (cognitive 33) frontend/src/stores/agent.ts:120 — agent.useAgentStore has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 11, boolean chains 9, loops 1 (nesting depth added 2). None of this is in the body itself: all 33 points belong to 19 function literals inside it that branch (lines 208, 141, 191, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BaseEngine.run_backtest (cognitive 32) · ×1
  • BaseEngine.run_backtest (cognitive 32) agent/backtest/engines/base.py:936 — BaseEngine.run_backtest has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 3 (6 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · fundamentals_loader._extract_concept_series (cognitive 32) · ×1
  • fundamentals_loader._extract_concept_series (cognitive 32) agent/backtest/loaders/fundamentals_loader.py:48 — fundamentals_loader._extract_concept_series has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 3 (6 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._fetch_one (cognitive 32) · ×1
  • DataLoader._fetch_one (cognitive 32) REDACTED:230 — DataLoader._fetch_one has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assertions._budget_verdicts (cognitive 32) · ×1
  • assertions._budget_verdicts (cognitive 32) agent/evals/harness/assertions.py:526 — assertions._budget_verdicts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 3 (8 pts), boolean chains 3, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures._numbers (cognitive 32) · ×1
  • figures._numbers (cognitive 32) agent/src/agent/grounding/figures.py:451 — figures._numbers has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 9, ternaries 5 (6 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures.table_rows (cognitive 32) · ×1
  • figures.table_rows (cognitive 32) agent/src/agent/grounding/figures.py:915 — figures.table_rows has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmRuntime._execute_run (cognitive 32) · ×1
  • SwarmRuntime._execute_run (cognitive 32) agent/src/swarm/runtime.py:517 — SwarmRuntime._execute_run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 5 (8 pts), ternaries 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · doc_reader_tool._read_pdf (cognitive 32) · ×1
  • doc_reader_tool._read_pdf (cognitive 32) agent/src/tools/doc_reader_tool.py:133 — doc_reader_tool._read_pdf has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 4 (7 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddGoalEvidenceTool.execute (cognitive 32) · ×1
  • AddGoalEvidenceTool.execute (cognitive 32) agent/src/tools/goal_tool.py:491 — AddGoalEvidenceTool.execute has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 25, if/else 4 (5 pts), error handling 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · tap_forward.forward (cognitive 32) · ×1
  • tap_forward.forward (cognitive 32) REDACTED:105 — tap_forward.forward has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 9, if/else 6 (8 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FactorResearchPanel.FactorResearchPanel (cognitive 32) · ×1
  • FactorResearchPanel.FactorResearchPanel (cognitive 32) frontend/src/components/charts/FactorResearchPanel.tsx:84 — FactorResearchPanel.FactorResearchPanel has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, ternaries 6 (11 pts), if/else 8 (nesting depth added 5). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 175, 113, 97, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · additive_conversion._plateau_spans (cognitive 31) · ×1
  • additive_conversion._plateau_spans (cognitive 31) agent/backtest/loaders/additive_conversion.py:47 — additive_conversion._plateau_spans has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (6 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_run (cognitive 31) · ×1
  • _legacy.cmd_run (cognitive 31) agent/cli/_legacy.py:1519 — _legacy.cmd_run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_dev (cognitive 31) · ×1
  • _legacy.cmd_dev (cognitive 31) agent/cli/_legacy.py:6593 — _legacy.cmd_dev has cognitive complexity 31 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 7 (11 pts), boolean chains 2, loops 2, ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assertions._identity_verdicts (cognitive 31) · ×1
  • assertions._identity_verdicts (cognitive 31) agent/evals/harness/assertions.py:347 — assertions._identity_verdicts has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 6 (12 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 · context_compact._fix_tool_pairs (cognitive 31) · ×1
  • context_compact._fix_tool_pairs (cognitive 31) agent/src/agent/context_compact.py:394 — context_compact._fix_tool_pairs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 7 (10 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _EvidenceMixin._record_backtest_outputs (cognitive 31) · ×1
  • _EvidenceMixin._record_backtest_outputs (cognitive 31) agent/src/agent/grounding/evidence.py:926 — _EvidenceMixin._record_backtest_outputs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PendingAction.validate_evidence (cognitive 31) · ×1
  • PendingAction.validate_evidence (cognitive 31) agent/src/live/pending_action.py:161 — PendingAction.validate_evidence has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 10, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · claude_cli_models._query_claude_cli_models (cognitive 31) · ×1
  • claude_cli_models._query_claude_cli_models (cognitive 31) agent/src/providers/claude_cli_models.py:74 — claude_cli_models._query_claude_cli_models has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (9 pts), boolean chains 6, error handling 2 (3 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attribution.brinson_fachler (cognitive 31) · ×1
  • attribution.brinson_fachler (cognitive 31) agent/src/quantlib/attribution.py:209 — attribution.brinson_fachler has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · neutralization.neutralize_factor (cognitive 31) · ×1
  • neutralization.neutralize_factor (cognitive 31) agent/src/quantlib/neutralization.py:204 — neutralization.neutralize_factor has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 6, ternaries 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmRuntime._execute_layer (cognitive 31) · ×1
  • SwarmRuntime._execute_layer (cognitive 31) agent/src/swarm/runtime.py:972 — SwarmRuntime._execute_layer has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 5 (8 pts), error handling 4 (7 pts), ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 31) · ×1
  • sdk.place_order (cognitive 31) agent/src/trading/connectors/binance/sdk.py:527 — sdk.place_order has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 10, error handling 2, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · local_plugins.parse_manifest (cognitive 31) · ×1
  • local_plugins.parse_manifest (cognitive 31) agent/src/trading/local_plugins.py:108 — local_plugins.parse_manifest has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 11 (13 pts), error handling 1, loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · check_i18n.main (cognitive 31) · ×1
  • check_i18n.main (cognitive 31) wiki/scripts/check_i18n.py:68 — check_i18n.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 8 (13 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QVerisSettings.QVerisSettings (cognitive 31) · ×1
  • QVerisSettings.QVerisSettings (cognitive 31) frontend/src/components/settings/QVerisSettings.tsx:80 — QVerisSettings.QVerisSettings has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 11, if/else 6, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 12 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (submit, load, a function literal at line 129, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Reports.Reports (cognitive 31) · ×1
  • Reports.Reports (cognitive 31) frontend/src/pages/Reports.tsx:23 — Reports.Reports has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 10, if/else 5, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 13 of the 31 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 66, loadReports, a function literal at line 60, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · _RunDashboard.render (cognitive 30) · ×1
  • _RunDashboard.render (cognitive 30) agent/cli/_legacy.py:795 — _RunDashboard.render has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 14 (19 pts), if/else 6 (7 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _legacy.cmd_trace (cognitive 30) · ×1
  • _legacy.cmd_trace (cognitive 30) agent/cli/_legacy.py:2604 — _legacy.cmd_trace has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ReleaseMixin.redacted_release (cognitive 30) · ×1
  • _ReleaseMixin.redacted_release (cognitive 30) agent/src/agent/grounding/release.py:539 — _ReleaseMixin.redacted_release has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · store.handle_pairing_command (cognitive 30) · ×1
  • store.handle_pairing_command (cognitive 30) agent/src/channels/pairing/store.py:233 — store.handle_pairing_command has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 5 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalChannel._sse_receive_loop (cognitive 30) · ×1
  • SignalChannel._sse_receive_loop (cognitive 30) REDACTED:609 — SignalChannel._sse_receive_loop has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 3 (7 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalChannel._assemble_inbound_content (cognitive 30) · ×1
  • SignalChannel._assemble_inbound_content (cognitive 30) REDACTED:921 — SignalChannel._assemble_inbound_content has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 2 (5 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalChannel._should_respond_in_group (cognitive 30) · ×1
  • SignalChannel._should_respond_in_group (cognitive 30) REDACTED:1230 — SignalChannel._should_respond_in_group has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (6 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · crossvalidation.group_purged_kfold_splits (cognitive 30) · ×1
  • crossvalidation.group_purged_kfold_splits (cognitive 30) agent/src/quantlib/crossvalidation.py:292 — crossvalidation.group_purged_kfold_splits has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (5 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · factormodel.factor_ic_analysis (cognitive 30) · ×1
  • factormodel.factor_ic_analysis (cognitive 30) agent/src/quantlib/factormodel.py:761 — factormodel.factor_ic_analysis has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 6 (11 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstitutionalHoldingsTool._top_managers (cognitive 30) · ×1
  • InstitutionalHoldingsTool._top_managers (cognitive 30) agent/src/tools/institutional_holdings_tool.py:2158 — InstitutionalHoldingsTool._top_managers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 8, loops 4 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schema._validate_node (cognitive 30) · ×1
  • schema._validate_node (cognitive 30) agent/src/tools/paper_trade/schema.py:619 — schema._validate_node has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report_audit_tool._report_value (cognitive 30) · ×1
  • report_audit_tool._report_value (cognitive 30) agent/src/tools/report_audit_tool.py:64 — report_audit_tool._report_value has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 30) · ×1
  • sdk.place_order (cognitive 30) agent/src/trading/connectors/futu/sdk.py:769 — sdk.place_order has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 6 (7 pts), boolean chains 5, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ResearchArtifacts.ResearchArtifacts (cognitive 30) · ×1
  • ResearchArtifacts.ResearchArtifacts (cognitive 30) frontend/src/pages/ResearchArtifacts.tsx:66 — ResearchArtifacts.ResearchArtifacts has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, ternaries 9 (12 pts), error handling 3, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (save, loadArtifacts, openArtifact, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · correlation._fetch_price_series (cognitive 29) · ×1
  • correlation._fetch_price_series (cognitive 29) agent/backtest/correlation.py:268 — correlation._fetch_price_series has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 2 (6 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgentinaEquityEngine.prepare_market_data (cognitive 29) · ×1
  • ArgentinaEquityEngine.prepare_market_data (cognitive 29) agent/backtest/engines/argentina_equity.py:469 — ArgentinaEquityEngine.prepare_market_data has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 4 (10 pts), loops 3, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base._read_loader_cache_frame (cognitive 29) · ×1
  • base._read_loader_cache_frame (cognitive 29) agent/backtest/loaders/base.py:723 — base._read_loader_cache_frame has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 8, error handling 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LongbridgeLoader.fetch (cognitive 29) · ×1
  • LongbridgeLoader.fetch (cognitive 29) agent/backtest/loaders/longbridge.py:256 — LongbridgeLoader.fetch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 4 (6 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._build_welcome_panel (cognitive 29) · ×1
  • _legacy._build_welcome_panel (cognitive 29) agent/cli/_legacy.py:1704 — _legacy._build_welcome_panel has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8, loops 4 (8 pts), ternaries 6 (8 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · runs_routes._iter_factor_series_files (cognitive 29) · ×1
  • runs_routes._iter_factor_series_files (cognitive 29) agent/src/api/runs_routes.py:222 — runs_routes._iter_factor_series_files has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 3 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MSTeamsChannel._handle_activity (cognitive 29) · ×1
  • MSTeamsChannel._handle_activity (cognitive 29) agent/src/channels/msteams.py:331 — MSTeamsChannel._handle_activity has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 20, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SignalChannel._start_http_mode (cognitive 29) · ×1
  • SignalChannel._start_http_mode (cognitive 29) REDACTED:474 — SignalChannel._start_http_mode has cognitive complexity 29 (threshold 15). Drivers by points: error handling 6 (14 pts), if/else 7 (14 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionSearchIndex.reindex_from_store (cognitive 29) · ×1
  • SessionSearchIndex.reindex_from_store (cognitive 29) agent/src/session/search.py:393 — SessionSearchIndex.reindex_from_store has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 4 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalEngine.generate (cognitive 29) · ×1
  • SignalEngine.generate (cognitive 29) agent/src/skills/elliott-wave/example_signal_engine.py:370 — SignalEngine.generate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · financial_statements_tool._fetch_yahoo_statement (cognitive 29) · ×1
  • financial_statements_tool._fetch_yahoo_statement (cognitive 29) agent/src/tools/financial_statements_tool.py:332 — financial_statements_tool._fetch_yahoo_statement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (8 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OrderBookDepthTool.execute (cognitive 29) · ×1
  • OrderBookDepthTool.execute (cognitive 29) agent/src/tools/orderbook_depth_tool.py:346 — OrderBookDepthTool.execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 6 (10 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · trade_journal_tool._compute_profile (cognitive 29) · ×1
  • trade_journal_tool._compute_profile (cognitive 29) agent/src/tools/trade_journal_tool.py:237 — trade_journal_tool._compute_profile has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 13 (18 pts), if/else 5 (6 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 29) · ×1
  • sdk.place_order (cognitive 29) agent/src/trading/connectors/upbit/sdk.py:376 — sdk.place_order has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 6, ternaries 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StrategyResearchDashboard.StrategyResearchDashboard (cognitive 29) · ×1
  • StrategyResearchDashboard.StrategyResearchDashboard (cognitive 29) frontend/src/components/charts/StrategyResearchDashboard.tsx:122 — StrategyResearchDashboard.StrategyResearchDashboard has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 19, if/else 5, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 140, 129, 195, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · _RunDashboard._render_progress_row (cognitive 28) · ×1
  • _RunDashboard._render_progress_row (cognitive 28) agent/cli/_legacy.py:719 — _RunDashboard._render_progress_row has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 12, error handling 1 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _legacy._dispatch_connector (cognitive 28) · ×1
  • _legacy._dispatch_connector (cognitive 28) agent/cli/_legacy.py:5419 — _legacy._dispatch_connector has cognitive complexity 28 (threshold 15). Drivers by points: if/else 23 (24 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_document_text (cognitive 28) · ×1
  • _EvidenceMixin._ingest_document_text (cognitive 28) agent/src/agent/grounding/evidence.py:1497 — _EvidenceMixin._ingest_document_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 2 (5 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attribution_core._attribution_equal_weight_returns (cognitive 28) · ×1
  • attribution_core._attribution_equal_weight_returns (cognitive 28) agent/src/api/attribution_core.py:279 — attribution_core._attribution_equal_weight_returns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WeixinChannel._download_media_item (cognitive 28) · ×1
  • WeixinChannel._download_media_item (cognitive 28) REDACTED:831 — WeixinChannel._download_media_item has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 10, error handling 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GoalStore._validate_completion_audit (cognitive 28) · ×1
  • GoalStore._validate_completion_audit (cognitive 28) agent/src/goal/store.py:899 — GoalStore._validate_completion_audit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 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.
D2 · Cognitive Complexity · PersistentMemory.add (cognitive 28) · ×1
  • PersistentMemory.add (cognitive 28) agent/src/memory/persistent.py:515 — PersistentMemory.add has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · combination._walk_forward_weights (cognitive 28) · ×1
  • combination._walk_forward_weights (cognitive 28) agent/src/quantlib/combination.py:207 — combination._walk_forward_weights has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options.bs_greeks (cognitive 28) · ×1
  • options.bs_greeks (cognitive 28) agent/src/quantlib/options.py:268 — options.bs_greeks has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 10 (13 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalEngine.generate (cognitive 28) · ×1
  • SignalEngine.generate (cognitive 28) agent/src/skills/fundamental-filter/example_signal_engine.py:75 — SignalEngine.generate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StrategyDiscoveryFacade.get_strategy_evidence (cognitive 28) · ×1
  • StrategyDiscoveryFacade.get_strategy_evidence (cognitive 28) agent/src/strategy_discovery/facade.py:606 — StrategyDiscoveryFacade.get_strategy_evidence has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 4 (6 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · presets.inspect_preset (cognitive 28) · ×1
  • presets.inspect_preset (cognitive 28) agent/src/swarm/presets.py:171 — presets.inspect_preset has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 9 (12 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundManager.check (cognitive 28) · ×1
  • BackgroundManager.check (cognitive 28) agent/src/tools/background_tools.py:445 — BackgroundManager.check has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GildataFundNavTool.execute (cognitive 28) · ×1
  • GildataFundNavTool.execute (cognitive 28) agent/src/tools/fund_nav_tool.py:137 — GildataFundNavTool.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 3 (6 pts), boolean chains 4, loops 3, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PredictionMarketTool.execute (cognitive 28) · ×1
  • PredictionMarketTool.execute (cognitive 28) agent/src/tools/prediction_market_tool.py:1118 — PredictionMarketTool.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SdmDecayScanTool.execute (cognitive 28) · ×1
  • SdmDecayScanTool.execute (cognitive 28) agent/src/tools/sdm_decay_scan_tool.py:64 — SdmDecayScanTool.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · service._close_etoro_position (cognitive 28) · ×1
  • service._close_etoro_position (cognitive 28) agent/src/trading/service.py:874 — service._close_etoro_position has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 4 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionCenter.ConnectionCenter (cognitive 28) · ×1
  • ConnectionCenter.ConnectionCenter (cognitive 28) frontend/src/components/portfolio/ConnectionCenter.tsx:21 — ConnectionCenter.ConnectionCenter has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 4, if/else 4, error handling 3, loops 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 28 points are its own statements and the rest belongs to 8 function items inside it that branch (create, test, compatibilityLabel, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · FutuLoader.fetch (cognitive 27) · ×1
  • FutuLoader.fetch (cognitive 27) agent/backtest/loaders/futu.py:148 — FutuLoader.fetch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._operands_read_as_points (cognitive 27) · ×1
  • _PolicyMixin._operands_read_as_points (cognitive 27) agent/src/agent/grounding/policies.py:2063 — _PolicyMixin._operands_read_as_points has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · write_targets.record_written_target (cognitive 27) · ×1
  • write_targets.record_written_target (cognitive 27) agent/src/agent/write_targets.py:29 — write_targets.record_written_target has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 6 (7 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackChannel.send (cognitive 27) · ×1
  • SlackChannel.send (cognitive 27) agent/src/channels/slack.py:174 — SlackChannel.send has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (6 pts), ternaries 3 (4 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · commit._profile_fits_ceilings (cognitive 27) · ×1
  • commit._profile_fits_ceilings (cognitive 27) agent/src/live/mandate/commit.py:348 — commit._profile_fits_ceilings has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 3, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioService._combine_holdings (cognitive 27) · ×1
  • PortfolioService._combine_holdings (cognitive 27) agent/src/portfolio/service.py:897 — PortfolioService._combine_holdings has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, ternaries 3 (6 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 · data.fetch_market_data (cognitive 27) · ×1
  • data.fetch_market_data (cognitive 27) agent/src/tools/paper_trade/data.py:429 — data.fetch_market_data has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · data_5m._split_session_days (cognitive 27) · ×1
  • data_5m._split_session_days (cognitive 27) agent/src/tools/paper_trade/data_5m.py:326 — data_5m._split_session_days has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdf_report._rtl_lines (cognitive 27) · ×1
  • pdf_report._rtl_lines (cognitive 27) agent/src/tools/pdf_report.py:62 — pdf_report._rtl_lines has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SymbolSearchTool.execute (cognitive 27) · ×1
  • SymbolSearchTool.execute (cognitive 27) agent/src/tools/symbol_search_tool.py:254 — SymbolSearchTool.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 9 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trade_journal_parsers.parse_generic (cognitive 27) · ×1
  • trade_journal_parsers.parse_generic (cognitive 27) agent/src/tools/trade_journal_parsers.py:571 — trade_journal_parsers.parse_generic has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 6 (10 pts), boolean chains 3, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usdm._join_positions (cognitive 27) · ×1
  • usdm._join_positions (cognitive 27) agent/src/trading/connectors/binance/usdm.py:144 — usdm._join_positions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trading.edit_position_stops (cognitive 27) · ×1
  • trading.edit_position_stops (cognitive 27) agent/src/trading/connectors/etoro/trading.py:218 — trading.edit_position_stops has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7, error handling 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · sdk._request (cognitive 27) · ×1
  • sdk._request (cognitive 27) agent/src/trading/connectors/kis/sdk.py:814 — sdk._request has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ui_services.infer_indicator_periods (cognitive 27) · ×1
  • ui_services.infer_indicator_periods (cognitive 27) agent/src/ui_services.py:151 — ui_services.infer_indicator_periods has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 8, error handling 2 (6 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_alpha_library.main (cognitive 27) · ×1
  • build_alpha_library.main (cognitive 27) wiki/scripts/build_alpha_library.py:483 — build_alpha_library.main has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunDetail.RunCardTab (cognitive 27) · ×1
  • RunDetail.RunCardTab (cognitive 27) frontend/src/pages/RunDetail.tsx:477 — RunDetail.RunCardTab has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, ternaries 9 (13 pts) (nesting depth added 4). Of this number, 17 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · argentina_equity.byma_cash_ledger (cognitive 26) · ×1
  • argentina_equity.byma_cash_ledger (cognitive 26) agent/backtest/engines/argentina_equity.py:691 — argentina_equity.byma_cash_ledger has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (7 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._fetch_minutes (cognitive 26) · ×1
  • DataLoader._fetch_minutes (cognitive 26) agent/backtest/loaders/tushare.py:331 — DataLoader._fetch_minutes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (9 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · yahoo_client._parse_chart (cognitive 26) · ×1
  • yahoo_client._parse_chart (cognitive 26) agent/backtest/loaders/yahoo_client.py:219 — yahoo_client._parse_chart has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 4 (7 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · runner._module_level_forbidden_aliases (cognitive 26) · ×1
  • runner._module_level_forbidden_aliases (cognitive 26) agent/backtest/runner.py:699 — runner._module_level_forbidden_aliases has cognitive complexity 26 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _SwarmDashboard.build_table (cognitive 26) · ×1
  • _SwarmDashboard.build_table (cognitive 26) agent/cli/_legacy.py:2233 — _SwarmDashboard.build_table has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 7 (8 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_compact._verification_ledger (cognitive 26) · ×1
  • context_compact._verification_ledger (cognitive 26) agent/src/agent/context_compact.py:114 — context_compact._verification_ledger has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 7, error handling 1 (2 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_compact._context_collapse (cognitive 26) · ×1
  • context_compact._context_collapse (cognitive 26) agent/src/agent/context_compact.py:292 — context_compact._context_collapse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, 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 · EmailChannel._extract_text_body (cognitive 26) · ×1
  • EmailChannel._extract_text_body (cognitive 26) agent/src/channels/email.py:919 — EmailChannel._extract_text_body has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel._parse_authentication_results_clauses (cognitive 26) · ×1
  • EmailChannel._parse_authentication_results_clauses (cognitive 26) agent/src/channels/email.py:1037 — EmailChannel._parse_authentication_results_clauses has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SSEEventMapper.map (cognitive 26) · ×1
  • SSEEventMapper.map (cognitive 26) agent/src/openbb_bridge/event_mapper.py:50 — SSEEventMapper.map has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 9, boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ShortPremium._run (cognitive 26) · ×1
  • _ShortPremium._run (cognitive 26) agent/src/skills/options-strategy/example_signal_engine.py:123 — _ShortPremium._run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, ternaries 1 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmRuntime._apply_resume_overlay (cognitive 26) · ×1
  • SwarmRuntime._apply_resume_overlay (cognitive 26) agent/src/swarm/runtime.py:782 — SwarmRuntime._apply_resume_overlay has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (8 pts), boolean chains 2, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · goal_tool._trace_fields_from_runtime (cognitive 26) · ×1
  • goal_tool._trace_fields_from_runtime (cognitive 26) agent/src/tools/goal_tool.py:72 — goal_tool._trace_fields_from_runtime has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, error handling 2 (7 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 · institutional_holdings_tool._resolve_chain_value (cognitive 26) · ×1
  • institutional_holdings_tool._resolve_chain_value (cognitive 26) agent/src/tools/institutional_holdings_tool.py:1431 — institutional_holdings_tool._resolve_chain_value has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 9, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data._fetch_cn_a (cognitive 26) · ×1
  • data._fetch_cn_a (cognitive 26) agent/src/tools/paper_trade/data.py:647 — data._fetch_cn_a has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (6 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · research_papers_tool._extract_performance (cognitive 26) · ×1
  • research_papers_tool._extract_performance (cognitive 26) agent/src/tools/research_papers_tool.py:740 — research_papers_tool._extract_performance has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 3 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options.buildPayoffRequest (cognitive 26) · ×1
  • options.buildPayoffRequest (cognitive 26) frontend/src/lib/options.ts:181 — options.buildPayoffRequest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunDetail.TradesTab (cognitive 26) · ×1
  • RunDetail.TradesTab (cognitive 26) frontend/src/pages/RunDetail.tsx:1001 — RunDetail.TradesTab has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, ternaries 7 (8 pts), if/else 1 (nesting depth added 1). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1112, 1020, 1053, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rebalance_mask.resolve_rebalance_dates (cognitive 25) · ×1
  • rebalance_mask.resolve_rebalance_dates (cognitive 25) agent/backtest/rebalance_mask.py:47 — rebalance_mask.resolve_rebalance_dates has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (4 pts), error handling 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._select_market_engine (cognitive 25) · ×1
  • runner._select_market_engine (cognitive 25) agent/backtest/runner.py:1746 — runner._select_market_engine has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · validation.walk_forward_analysis (cognitive 25) · ×1
  • validation.walk_forward_analysis (cognitive 25) agent/backtest/validation.py:232 — validation.walk_forward_analysis has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 7 (11 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validation._load_trades (cognitive 25) · ×1
  • validation._load_trades (cognitive 25) agent/backtest/validation.py:407 — validation._load_trades has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (5 pts), error handling 1 (4 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.
D2 · Cognitive Complexity · context_compact._summary_chunks (cognitive 25) · ×1
  • context_compact._summary_chunks (cognitive 25) agent/src/agent/context_compact.py:37 — context_compact._summary_chunks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (6 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · identity._infer_instrument_type (cognitive 25) · ×1
  • identity._infer_instrument_type (cognitive 25) agent/src/agent/grounding/identity.py:347 — identity._infer_instrument_type has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NapcatChannel._parse_segments (cognitive 25) · ×1
  • NapcatChannel._parse_segments (cognitive 25) agent/src/channels/napcat.py:309 — NapcatChannel._parse_segments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebSocketChannel._save_envelope_media (cognitive 25) · ×1
  • WebSocketChannel._save_envelope_media (cognitive 25) REDACTED:604 — WebSocketChannel._save_envelope_media has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (4 pts), ternaries 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioStore.history (cognitive 25) · ×1
  • PortfolioStore.history (cognitive 25) agent/src/portfolio/store.py:143 — PortfolioStore.history has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, ternaries 3 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · neutralization._select (cognitive 25) · ×1
  • neutralization._select (cognitive 25) agent/src/quantlib/neutralization.py:143 — neutralization._select has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionService._record_tool_trail_event (cognitive 25) · ×1
  • SessionService._record_tool_trail_event (cognitive 25) agent/src/session/service.py:732 — SessionService._record_tool_trail_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7, ternaries 3 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · alpha_bench_tool._load_csi300_panel (cognitive 25) · ×1
  • alpha_bench_tool._load_csi300_panel (cognitive 25) agent/src/tools/alpha_bench_tool.py:316 — alpha_bench_tool._load_csi300_panel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, error handling 3 (4 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtfHoldingsTool.execute (cognitive 25) · ×1
  • EtfHoldingsTool.execute (cognitive 25) agent/src/tools/etf_holdings_tool.py:1806 — EtfHoldingsTool.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 4 (6 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · financial_rigor_tool.verify_valuation (cognitive 25) · ×1
  • financial_rigor_tool.verify_valuation (cognitive 25) agent/src/tools/financial_rigor_tool.py:192 — financial_rigor_tool.verify_valuation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (24 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 · FredMacroTool.execute (cognitive 25) · ×1
  • FredMacroTool.execute (cognitive 25) agent/src/tools/fred_macro_tool.py:114 — FredMacroTool.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report_audit_tool.render_verdict (cognitive 25) · ×1
  • report_audit_tool.render_verdict (cognitive 25) agent/src/tools/report_audit_tool.py:348 — report_audit_tool.render_verdict has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (4 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 · symbol_search_tool._canonical_crypto_pair (cognitive 25) · ×1
  • symbol_search_tool._canonical_crypto_pair (cognitive 25) agent/src/tools/symbol_search_tool.py:426 — symbol_search_tool._canonical_crypto_pair has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtoroClient.request (cognitive 25) · ×1
  • EtoroClient.request (cognitive 25) agent/src/trading/connectors/etoro/client.py:280 — EtoroClient.request has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, error handling 2 (4 pts), ternaries 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 · instruments.resolve_instrument_id (cognitive 25) · ×1
  • instruments.resolve_instrument_id (cognitive 25) agent/src/trading/connectors/etoro/instruments.py:295 — instruments.resolve_instrument_id has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk._extract_positions (cognitive 25) · ×1
  • sdk._extract_positions (cognitive 25) agent/src/trading/connectors/etoro/sdk.py:318 — sdk._extract_positions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AlphaZoo.DetailView (cognitive 25) · ×1
  • AlphaZoo.DetailView (cognitive 25) frontend/src/pages/AlphaZoo.tsx:457 — AlphaZoo.DetailView has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, ternaries 6 (8 pts), if/else 5 (nesting depth added 2). Of this number, 21 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · assertions._tool_result_join_verdict (cognitive 24) · ×1
  • assertions._tool_result_join_verdict (cognitive 24) agent/evals/harness/assertions.py:713 — assertions._tool_result_join_verdict has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evidence._metric_kind_for_path (cognitive 24) · ×1
  • evidence._metric_kind_for_path (cognitive 24) agent/src/agent/grounding/evidence.py:593 — evidence._metric_kind_for_path has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (5 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AttemptProgress.poll (cognitive 24) · ×1
  • AttemptProgress.poll (cognitive 24) agent/src/channels/attempt_progress.py:36 — AttemptProgress.poll has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 5, 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 · FeishuChannel._format_tool_hint_lines (cognitive 24) · ×1
  • FeishuChannel._format_tool_hint_lines (cognitive 24) agent/src/channels/feishu.py:2442 — FeishuChannel._format_tool_hint_lines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · feishu._extract_post_content (cognitive 24) · ×1
  • feishu._extract_post_content (cognitive 24) agent/src/channels/feishu.py:305 — feishu._extract_post_content has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QQChannel._download_to_media_dir_chunked (cognitive 24) · ×1
  • QQChannel._download_to_media_dir_chunked (cognitive 24) agent/src/channels/qq.py:660 — QQChannel._download_to_media_dir_chunked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · enforcement._check_universe_floors (cognitive 24) · ×1
  • enforcement._check_universe_floors (cognitive 24) agent/src/live/enforcement.py:651 — enforcement._check_universe_floors has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 4 (6 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryHierarchy.recover_extensionless_entries (cognitive 24) · ×1
  • MemoryHierarchy.recover_extensionless_entries (cognitive 24) agent/src/memory/hierarchy.py:92 — MemoryHierarchy.recover_extensionless_entries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backtester._load_metrics (cognitive 24) · ×1
  • backtester._load_metrics (cognitive 24) REDACTED:447 — backtester._load_metrics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 2 (4 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundManager._execute (cognitive 24) · ×1
  • BackgroundManager._execute (cognitive 24) agent/src/tools/background_tools.py:280 — BackgroundManager._execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (7 pts), error handling 3 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarketDataTool.execute (cognitive 24) · ×1
  • MarketDataTool.execute (cognitive 24) agent/src/tools/market_data_tool.py:157 — MarketDataTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · QVerisExecuteTool.execute (cognitive 24) · ×1
  • QVerisExecuteTool.execute (cognitive 24) agent/src/tools/qveris_tool.py:567 — QVerisExecuteTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 10, error handling 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · research_papers_tool._read_openalex (cognitive 24) · ×1
  • research_papers_tool._read_openalex (cognitive 24) agent/src/tools/research_papers_tool.py:1403 — research_papers_tool._read_openalex has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · instruments.search_instruments (cognitive 24) · ×1
  • instruments.search_instruments (cognitive 24) agent/src/trading/connectors/etoro/instruments.py:157 — instruments.search_instruments has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 24) · ×1
  • sdk.place_order (cognitive 24) agent/src/trading/connectors/kis/sdk.py:470 — sdk.place_order has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 9, if/else 9, ternaries 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _client._usd_contract_value (cognitive 24) · ×1
  • _client._usd_contract_value (cognitive 24) REDACTED:385 — _client._usd_contract_value has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (8 pts), boolean chains 4, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backend-manager.resolveBackend (cognitive 24) · ×1
  • backend-manager.resolveBackend (cognitive 24) desktop/electron/src/backend-manager.ts:310 — backend-manager.resolveBackend has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (6 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 · RunCompleteCard.RunCompleteCard (cognitive 24) · ×1
  • RunCompleteCard.RunCompleteCard (cognitive 24) frontend/src/components/chat/RunCompleteCard.tsx:25 — RunCompleteCard.RunCompleteCard has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 9 (10 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 70, 35, 54, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ToolProgressIndicator.ToolRow (cognitive 24) · ×1
  • ToolProgressIndicator.ToolRow (cognitive 24) frontend/src/components/chat/ToolProgressIndicator.tsx:128 — ToolProgressIndicator.ToolRow has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, ternaries 4 (7 pts), if/else 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ModelPicker.ModelPicker (cognitive 24) · ×1
  • ModelPicker.ModelPicker (cognitive 24) frontend/src/components/settings/ModelPicker.tsx:13 — ModelPicker.ModelPicker has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5 (8 pts), boolean chains 4 (nesting depth added 7). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 5 function items inside it that branch (onKeyDown, a function literal at line 58, a function literal at line 28, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · attachments.extractUploadedAttachments (cognitive 24) · ×1
  • attachments.extractUploadedAttachments (cognitive 24) frontend/src/lib/attachments.ts:24 — attachments.extractUploadedAttachments has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 14). Of this number, 14 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Correlation.Correlation (cognitive 24) · ×1
  • Correlation.Correlation (cognitive 24) frontend/src/pages/Correlation.tsx:11 — Correlation.Correlation has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 4 (6 pts), if/else 4 (5 pts), error handling 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · additive_conversion.convert_additive_to_multiplicative (cognitive 23) · ×1
  • additive_conversion.convert_additive_to_multiplicative (cognitive 23) agent/backtest/loaders/additive_conversion.py:103 — additive_conversion.convert_additive_to_multiplicative has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, loops 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · valuation_loader._load_baostock_valuation (cognitive 23) · ×1
  • valuation_loader._load_baostock_valuation (cognitive 23) agent/backtest/loaders/valuation_loader.py:138 — valuation_loader._load_baostock_valuation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader.fetch (cognitive 23) · ×1
  • DataLoader.fetch (cognitive 23) agent/backtest/loaders/yfinance_loader.py:279 — DataLoader.fetch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5 (8 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rebalance_notes.compute_rebalance_notes (cognitive 23) · ×1
  • rebalance_notes.compute_rebalance_notes (cognitive 23) agent/backtest/rebalance_notes.py:34 — rebalance_notes.compute_rebalance_notes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 5 (7 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · research_playbook.run (cognitive 23) · ×1
  • research_playbook.run (cognitive 23) agent/cli/commands/research_playbook.py:398 — research_playbook.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · mcp_server.run_swarm (cognitive 23) · ×1
  • mcp_server.run_swarm (cognitive 23) agent/mcp_server.py:1897 — mcp_server.run_swarm has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures._fenced_blocks (cognitive 23) · ×1
  • figures._fenced_blocks (cognitive 23) agent/src/agent/grounding/figures.py:649 — figures._fenced_blocks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (5 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.
D2 · Cognitive Complexity · result_artifacts.deliver_tool_result (cognitive 23) · ×1
  • result_artifacts.deliver_tool_result (cognitive 23) agent/src/agent/result_artifacts.py:60 — result_artifacts.deliver_tool_result has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), error handling 3, ternaries 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · runs_routes._build_positions_sector_map (cognitive 23) · ×1
  • runs_routes._build_positions_sector_map (cognitive 23) agent/src/api/runs_routes.py:530 — runs_routes._build_positions_sector_map has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, error handling 3 (4 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatrixChannel._handle_key_verification_event (cognitive 23) · ×1
  • MatrixChannel._handle_key_verification_event (cognitive 23) agent/src/channels/matrix.py:624 — MatrixChannel._handle_key_verification_event has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramChannel._process_message_update (cognitive 23) · ×1
  • TelegramChannel._process_message_update (cognitive 23) agent/src/channels/telegram.py:1462 — TelegramChannel._process_message_update has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WecomChannel.send (cognitive 23) · ×1
  • WecomChannel.send (cognitive 23) REDACTED:498 — WecomChannel.send has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context.format_goal_continuation_prompt (cognitive 23) · ×1
  • context.format_goal_continuation_prompt (cognitive 23) agent/src/goal/context.py:94 — context.format_goal_continuation_prompt has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (4 pts), ternaries 2 (3 pts), loops 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MemoryHierarchy._parse_index_keywords (cognitive 23) · ×1
  • MemoryHierarchy._parse_index_keywords (cognitive 23) agent/src/memory/hierarchy.py:263 — MemoryHierarchy._parse_index_keywords has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatLLM._parse_response (cognitive 23) · ×1
  • ChatLLM._parse_response (cognitive 23) agent/src/providers/chat.py:664 — ChatLLM._parse_response has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), ternaries 4, error handling 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · factormodel.factor_risk_decomposition (cognitive 23) · ×1
  • factormodel.factor_risk_decomposition (cognitive 23) agent/src/quantlib/factormodel.py:601 — factormodel.factor_risk_decomposition has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 3, boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · risk.drawdown_distribution_analysis (cognitive 23) · ×1
  • risk.drawdown_distribution_analysis (cognitive 23) agent/src/quantlib/risk.py:326 — risk.drawdown_distribution_analysis has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scanner._compare (cognitive 23) · ×1
  • scanner._compare (cognitive 23) agent/src/shadow_account/scanner.py:236 — scanner._compare has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · adaptation_workflow.prepare_adaptation (cognitive 23) · ×1
  • adaptation_workflow.prepare_adaptation (cognitive 23) agent/src/strategy_discovery/adaptation_workflow.py:18 — adaptation_workflow.prepare_adaptation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, ternaries 2, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · path_utils.resolve_safe_path (cognitive 23) · ×1
  • path_utils.resolve_safe_path (cognitive 23) agent/src/tools/path_utils.py:208 — path_utils.resolve_safe_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts), error handling 2 (4 pts), ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 23) · ×1
  • sdk.place_order (cognitive 23) agent/src/trading/connectors/longbridge/sdk.py:482 — sdk.place_order has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 4, error handling 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ConnectionCenter.AccountSelector (cognitive 23) · ×1
  • ConnectionCenter.AccountSelector (cognitive 23) frontend/src/components/portfolio/ConnectionCenter.tsx:246 — ConnectionCenter.AccountSelector has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 3, error handling 2, if/else 1 (nesting depth added 5). Of this number, 12 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tearsheet.computeMonthlyReturns (cognitive 23) · ×1
  • tearsheet.computeMonthlyReturns (cognitive 23) frontend/src/lib/tearsheet.ts:106 — tearsheet.computeMonthlyReturns has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlphaZoo.BenchView (cognitive 23) · ×1
  • AlphaZoo.BenchView (cognitive 23) frontend/src/pages/AlphaZoo.tsx:641 — AlphaZoo.BenchView has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, ternaries 8, if/else 1. Of this number, 13 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · argentina_equity.reconcile_ratio_changes (cognitive 22) · ×1
  • argentina_equity.reconcile_ratio_changes (cognitive 22) agent/backtest/engines/argentina_equity.py:259 — argentina_equity.reconcile_ratio_changes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loader_health.probe (cognitive 22) · ×1
  • loader_health.probe (cognitive 22) agent/backtest/loader_health.py:192 — loader_health.probe has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (6 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sec_edgar_client.get_company_facts (cognitive 22) · ×1
  • sec_edgar_client.get_company_facts (cognitive 22) agent/backtest/loaders/sec_edgar_client.py:217 — sec_edgar_client.get_company_facts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_card._metric_citations (cognitive 22) · ×1
  • run_card._metric_citations (cognitive 22) agent/backtest/run_card.py:458 — run_card._metric_citations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · runner._scan_runtime_reachable (cognitive 22) · ×1
  • runner._scan_runtime_reachable (cognitive 22) agent/backtest/runner.py:746 — runner._scan_runtime_reachable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._ast_config_keys (cognitive 22) · ×1
  • runner._ast_config_keys (cognitive 22) agent/backtest/runner.py:1312 — runner._ast_config_keys has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 10, 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 · _SwarmDashboard.handle_event (cognitive 22) · ×1
  • _SwarmDashboard.handle_event (cognitive 22) agent/cli/_legacy.py:2162 — _SwarmDashboard.handle_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 5 (10 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_interactive (cognitive 22) · ×1
  • _legacy.cmd_interactive (cognitive 22) agent/cli/_legacy.py:2056 — _legacy.cmd_interactive has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assertions._tool_verdicts (cognitive 22) · ×1
  • assertions._tool_verdicts (cognitive 22) agent/evals/harness/assertions.py:259 — assertions._tool_verdicts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_analysis_result (cognitive 22) · ×1
  • _EvidenceMixin._ingest_analysis_result (cognitive 22) agent/src/agent/grounding/evidence.py:730 — _EvidenceMixin._ingest_analysis_result has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8 (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 · channels_config_routes._apply_update (cognitive 22) · ×1
  • channels_config_routes._apply_update (cognitive 22) agent/src/api/channels_config_routes.py:454 — channels_config_routes._apply_update has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, error handling 3 (5 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings_routes._build_llm_settings_response (cognitive 22) · ×1
  • settings_routes._build_llm_settings_response (cognitive 22) agent/src/api/settings_routes.py:510 — settings_routes._build_llm_settings_response has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (10 pts), error handling 3 (6 pts), if/else 3 (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.
D2 · Cognitive Complexity · cvm_companies.sync (cognitive 22) · ×1
  • cvm_companies.sync (cognitive 22) agent/src/br_data/cvm_companies.py:128 — cvm_companies.sync has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (6 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 · DiscordChannel.send_delta (cognitive 22) · ×1
  • DiscordChannel.send_delta (cognitive 22) agent/src/channels/discord.py:513 — DiscordChannel.send_delta has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · EmailChannel._check_authentication_results (cognitive 22) · ×1
  • EmailChannel._check_authentication_results (cognitive 22) agent/src/channels/email.py:1095 — EmailChannel._check_authentication_results has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7, ternaries 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeishuChannel._download_and_save_media (cognitive 22) · ×1
  • FeishuChannel._download_and_save_media (cognitive 22) agent/src/channels/feishu.py:1529 — FeishuChannel._download_and_save_media has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignalChannel._check_inbound_policy (cognitive 22) · ×1
  • SignalChannel._check_inbound_policy (cognitive 22) REDACTED:839 — SignalChannel._check_inbound_policy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _EnvBase._load_from_env (cognitive 22) · ×1
  • _EnvBase._load_from_env (cognitive 22) agent/src/config/env_schema.py:116 — _EnvBase._load_from_env has cognitive complexity 22 (threshold 15). Drivers by points: error handling 2 (8 pts), if/else 4 (8 pts), boolean chains 5, 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 · enforcement.check_mandate (cognitive 22) · ×1
  • enforcement.check_mandate (cognitive 22) agent/src/live/enforcement.py:476 — enforcement.check_mandate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 5, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · normalization.account_total_usd (cognitive 22) · ×1
  • normalization.account_total_usd (cognitive 22) agent/src/portfolio/normalization.py:248 — normalization.account_total_usd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (6 pts), boolean chains 5, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rebalance.propose_rebalance (cognitive 22) · ×1
  • rebalance.propose_rebalance (cognitive 22) agent/src/portfolio/rebalance.py:13 — rebalance.propose_rebalance has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 3, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sec_filings_example.recent_filings (cognitive 22) · ×1
  • sec_filings_example.recent_filings (cognitive 22) agent/src/skills/sec-edgar/scripts/sec_filings_example.py:47 — sec_filings_example.recent_filings has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), ternaries 3 (6 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backtest_tool.run_backtest (cognitive 22) · ×1
  • backtest_tool.run_backtest (cognitive 22) agent/src/tools/backtest_tool.py:193 — backtest_tool.run_backtest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 4 (5 pts), error handling 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · GetFundamentalsTool.execute (cognitive 22) · ×1
  • GetFundamentalsTool.execute (cognitive 22) agent/src/tools/get_fundamentals_tool.py:126 — GetFundamentalsTool.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · engine.run_day_loop (cognitive 22) · ×1
  • engine.run_day_loop (cognitive 22) agent/src/tools/paper_trade/engine.py:587 — engine.run_day_loop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmTool.execute (cognitive 22) · ×1
  • SwarmTool.execute (cognitive 22) agent/src/tools/swarm_tool.py:536 — SwarmTool.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 3, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trade_journal_parsers._infer_market_from_symbol (cognitive 22) · ×1
  • trade_journal_parsers._infer_market_from_symbol (cognitive 22) agent/src/tools/trade_journal_parsers.py:694 — trade_journal_parsers._infer_market_from_symbol has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Compare.EquityChartOverlay (cognitive 22) · ×1
  • Compare.EquityChartOverlay (cognitive 22) frontend/src/pages/Compare.tsx:120 — Compare.EquityChartOverlay has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), loops 3, ternaries 2 (3 pts) (nesting depth added 2). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 124, 162, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Portfolio.AccountCard (cognitive 22) · ×1
  • Portfolio.AccountCard (cognitive 22) frontend/src/pages/Portfolio.tsx:547 — Portfolio.AccountCard has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 4, if/else 1 (nesting depth added 5). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · correlation._rolling_correlation_matrix (cognitive 21) · ×1
  • correlation._rolling_correlation_matrix (cognitive 21) agent/backtest/correlation.py:176 — correlation._rolling_correlation_matrix has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (5 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_continue (cognitive 21) · ×1
  • _legacy.cmd_continue (cognitive 21) agent/cli/_legacy.py:1608 — _legacy.cmd_continue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._handle_swarm_command (cognitive 21) · ×1
  • _legacy._handle_swarm_command (cognitive 21) agent/cli/_legacy.py:2009 — _legacy._handle_swarm_command has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_swarm_inspect (cognitive 21) · ×1
  • _legacy.cmd_swarm_inspect (cognitive 21) agent/cli/_legacy.py:2714 — _legacy.cmd_swarm_inspect has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (8 pts), boolean chains 4, if/else 4, ternaries 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_init (cognitive 21) · ×1
  • _legacy.cmd_init (cognitive 21) agent/cli/_legacy.py:6334 — _legacy.cmd_init has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (7 pts), loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main._render_mandate_proposal (cognitive 21) · ×1
  • main._render_mandate_proposal (cognitive 21) agent/cli/main.py:1000 — main._render_mandate_proposal has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · release._correction_line (cognitive 21) · ×1
  • release._correction_line (cognitive 21) agent/src/agent/grounding/release.py:99 — release._correction_line has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, ternaries 6 (7 pts), if/else 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MatrixChannel.start (cognitive 21) · ×1
  • MatrixChannel.start (cognitive 21) agent/src/channels/matrix.py:255 — MatrixChannel.start has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MSTeamsChannel._prune_conversation_refs (cognitive 21) · ×1
  • MSTeamsChannel._prune_conversation_refs (cognitive 21) agent/src/channels/msteams.py:727 — MSTeamsChannel._prune_conversation_refs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (2 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QQChannel._on_message (cognitive 21) · ×1
  • QQChannel._on_message (cognitive 21) agent/src/channels/qq.py:531 — QQChannel._on_message has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (5 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · Runner.execute (cognitive 21) · ×1
  • Runner.execute (cognitive 21) REDACTED:594 — Runner.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · compare_runner.compare_alphas (cognitive 21) · ×1
  • compare_runner.compare_alphas (cognitive 21) agent/src/factors/compare_runner.py:88 — compare_runner.compare_alphas has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · data_availability.build_availability_contract (cognitive 21) · ×1
  • data_availability.build_availability_contract (cognitive 21) agent/src/factors/data_availability.py:229 — data_availability.build_availability_contract has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk_order_gate._recover_pending_order (cognitive 21) · ×1
  • sdk_order_gate._recover_pending_order (cognitive 21) agent/src/live/sdk_order_gate.py:542 — sdk_order_gate._recover_pending_order has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8, error handling 4 (7 pts), boolean chains 3, ternaries 3 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MemoryHierarchy.scan_all (cognitive 21) · ×1
  • MemoryHierarchy.scan_all (cognitive 21) agent/src/memory/hierarchy.py:145 — MemoryHierarchy.scan_all has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryHierarchy.prune_search_scope (cognitive 21) · ×1
  • MemoryHierarchy.prune_search_scope (cognitive 21) agent/src/memory/hierarchy.py:313 — MemoryHierarchy.prune_search_scope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PersistentMemory._scan_entries (cognitive 21) · ×1
  • PersistentMemory._scan_entries (cognitive 21) agent/src/memory/persistent.py:230 — PersistentMemory._scan_entries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (6 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceContextInjector._format_tool_results (cognitive 21) · ×1
  • WorkspaceContextInjector._format_tool_results (cognitive 21) agent/src/openbb_bridge/context_injector.py:167 — WorkspaceContextInjector._format_tool_results has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compatibility.adapt_and_validate_payloads (cognitive 21) · ×1
  • compatibility.adapt_and_validate_payloads (cognitive 21) agent/src/portfolio/compatibility.py:131 — compatibility.adapt_and_validate_payloads has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai_codex._get_codex_token (cognitive 21) · ×1
  • openai_codex._get_codex_token (cognitive 21) agent/src/providers/openai_codex.py:330 — openai_codex._get_codex_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool_policy.check_bash_command (cognitive 21) · ×1
  • tool_policy.check_bash_command (cognitive 21) agent/src/providers/tool_policy.py:84 — tool_policy.check_bash_command has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · microstructure.vpin (cognitive 21) · ×1
  • microstructure.vpin (cognitive 21) agent/src/quantlib/microstructure.py:132 — microstructure.vpin has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · artifact._flatten (cognitive 21) · ×1
  • artifact._flatten (cognitive 21) agent/src/quantlib/valuation/artifact.py:399 — artifact._flatten has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 3 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ResearchPlaybook.to_job (cognitive 21) · ×1
  • ResearchPlaybook.to_job (cognitive 21) agent/src/scheduled_research/playbooks.py:142 — ResearchPlaybook.to_job has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 5 (6 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionService._run_attempt (cognitive 21) · ×1
  • SessionService._run_attempt (cognitive 21) agent/src/session/service.py:446 — SessionService._run_attempt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, error handling 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.
D2 · Cognitive Complexity · SessionService._convert_messages_to_history (cognitive 21) · ×1
  • SessionService._convert_messages_to_history (cognitive 21) agent/src/session/service.py:807 — SessionService._convert_messages_to_history has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (6 pts), boolean chains 3, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etf_holdings_tool._lookup_cn (cognitive 21) · ×1
  • etf_holdings_tool._lookup_cn (cognitive 21) agent/src/tools/etf_holdings_tool.py:1308 — etf_holdings_tool._lookup_cn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPServerAdapter._build_client (cognitive 21) · ×1
  • MCPServerAdapter._build_client (cognitive 21) agent/src/tools/mcp.py:661 — MCPServerAdapter._build_client has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (13 pts), boolean chains 4, if/else 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 · mcp._normalize_schema_node (cognitive 21) · ×1
  • mcp._normalize_schema_node (cognitive 21) agent/src/tools/mcp.py:1020 — mcp._normalize_schema_node has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OptionsChainTool.execute (cognitive 21) · ×1
  • OptionsChainTool.execute (cognitive 21) agent/src/tools/options_chain_tool.py:71 — OptionsChainTool.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _MatchSession._day_gate (cognitive 21) · ×1
  • _MatchSession._day_gate (cognitive 21) agent/src/tools/paper_trade/engine.py:269 — _MatchSession._day_gate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioRiskXrayTool._closes_frame (cognitive 21) · ×1
  • PortfolioRiskXrayTool._closes_frame (cognitive 21) agent/src/tools/portfolio_risk_tool.py:187 — PortfolioRiskXrayTool._closes_frame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReportAuditTool.execute (cognitive 21) · ×1
  • ReportAuditTool.execute (cognitive 21) agent/src/tools/report_audit_tool.py:561 — ReportAuditTool.execute has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), error handling 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · research_papers_tool._arxiv_paper (cognitive 21) · ×1
  • research_papers_tool._arxiv_paper (cognitive 21) agent/src/tools/research_papers_tool.py:1016 — research_papers_tool._arxiv_paper has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, ternaries 4, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ShareholderCountTool.execute (cognitive 21) · ×1
  • ShareholderCountTool.execute (cognitive 21) agent/src/tools/shareholder_count_tool.py:83 — ShareholderCountTool.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk._enrich_positions_with_metadata (cognitive 21) · ×1
  • sdk._enrich_positions_with_metadata (cognitive 21) agent/src/trading/connectors/etoro/sdk.py:422 — sdk._enrich_positions_with_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (5 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MonthlyReturnsHeatmap.MonthlyReturnsHeatmap (cognitive 21) · ×1
  • MonthlyReturnsHeatmap.MonthlyReturnsHeatmap (cognitive 21) frontend/src/components/charts/MonthlyReturnsHeatmap.tsx:17 — MonthlyReturnsHeatmap.MonthlyReturnsHeatmap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 3, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 20, 58, 95). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useAlphaJob.useAlphaJob (cognitive 21) · ×1
  • useAlphaJob.useAlphaJob (cognitive 21) frontend/src/hooks/useAlphaJob.ts:9 — useAlphaJob.useAlphaJob has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (15 pts), boolean chains 4, if/else 2 (nesting depth added 9). None of this is in the body itself: all 21 points belong to 4 function literals inside it that branch (lines 64, 74, 71, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BaseEngine.historical_base_price (cognitive 20) · ×1
  • BaseEngine.historical_base_price (cognitive 20) agent/backtest/engines/base.py:680 — BaseEngine.historical_base_price has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._fetch_one (cognitive 20) · ×1
  • DataLoader._fetch_one (cognitive 20) agent/backtest/loaders/local_loader.py:355 — DataLoader._fetch_one has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._reject_forbidden_open (cognitive 20) · ×1
  • runner._reject_forbidden_open (cognitive 20) agent/backtest/runner.py:557 — runner._reject_forbidden_open has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner.main (cognitive 20) · ×1
  • runner.main (cognitive 20) agent/backtest/runner.py:1433 — runner.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (14 pts), error handling 5, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · mcp_server.alpha_bench (cognitive 20) · ×1
  • mcp_server.alpha_bench (cognitive 20) agent/mcp_server.py:1008 — mcp_server.alpha_bench has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 5, error handling 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · context_compact._attach_tool_call_thought_signatures (cognitive 20) · ×1
  • context_compact._attach_tool_call_thought_signatures (cognitive 20) agent/src/agent/context_compact.py:451 — context_compact._attach_tool_call_thought_signatures has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel._authentication_results_segments (cognitive 20) · ×1
  • EmailChannel._authentication_results_segments (cognitive 20) agent/src/channels/email.py:959 — EmailChannel._authentication_results_segments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NapcatChannel._on_message (cognitive 20) · ×1
  • NapcatChannel._on_message (cognitive 20) agent/src/channels/napcat.py:233 — NapcatChannel._on_message has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · signal._partition_styles (cognitive 20) · ×1
  • signal._partition_styles (cognitive 20) REDACTED:262 — signal._partition_styles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data_availability._source_for (cognitive 20) · ×1
  • data_availability._source_for (cognitive 20) agent/src/factors/data_availability.py:170 — data_availability._source_for has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 8, 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 · Registry.compute (cognitive 20) · ×1
  • Registry.compute (cognitive 20) agent/src/factors/registry.py:325 — Registry.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (4 pts), error handling 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · HypothesisRegistry.update (cognitive 20) · ×1
  • HypothesisRegistry.update (cognitive 20) agent/src/hypotheses/registry.py:214 — HypothesisRegistry.update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, ternaries 8, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PortfolioService._warnings (cognitive 20) · ×1
  • PortfolioService._warnings (cognitive 20) agent/src/portfolio/service.py:1200 — PortfolioService._warnings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · fixedincome.fit_yield_curve (cognitive 20) · ×1
  • fixedincome.fit_yield_curve (cognitive 20) agent/src/quantlib/fixedincome.py:733 — fixedincome.fit_yield_curve has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · performance._normalize_valuations (cognitive 20) · ×1
  • performance._normalize_valuations (cognitive 20) agent/src/quantlib/performance.py:281 — performance._normalize_valuations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backtest_runs_tool.list_backtest_runs (cognitive 20) · ×1
  • backtest_runs_tool.list_backtest_runs (cognitive 20) agent/src/tools/backtest_runs_tool.py:133 — backtest_runs_tool.list_backtest_runs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 4, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · financial_statements_tool._synthesize_fiscal_q4 (cognitive 20) · ×1
  • financial_statements_tool._synthesize_fiscal_q4 (cognitive 20) agent/src/tools/financial_statements_tool.py:575 — financial_statements_tool._synthesize_fiscal_q4 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoadSkillTool.execute (cognitive 20) · ×1
  • LoadSkillTool.execute (cognitive 20) agent/src/tools/load_skill_tool.py:207 — LoadSkillTool.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OptionsPricingTool.execute (cognitive 20) · ×1
  • OptionsPricingTool.execute (cognitive 20) agent/src/tools/options_pricing_tool.py:95 — OptionsPricingTool.execute has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 2 (3 pts), error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · quantlib_tool._encode (cognitive 20) · ×1
  • quantlib_tool._encode (cognitive 20) agent/src/tools/quantlib_tool.py:182 — quantlib_tool._encode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · stock_news_tool._fetch_eastmoney_news (cognitive 20) · ×1
  • stock_news_tool._fetch_eastmoney_news (cognitive 20) agent/src/tools/stock_news_tool.py:151 — stock_news_tool._fetch_eastmoney_news has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · trade_journal_parsers.parse_eastmoney (cognitive 20) · ×1
  • trade_journal_parsers.parse_eastmoney (cognitive 20) agent/src/tools/trade_journal_parsers.py:408 — trade_journal_parsers.parse_eastmoney has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trade_journal_parsers._generic_datetime_cell (cognitive 20) · ×1
  • trade_journal_parsers._generic_datetime_cell (cognitive 20) agent/src/tools/trade_journal_parsers.py:667 — trade_journal_parsers._generic_datetime_cell has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · orders.place_order (cognitive 20) · ×1
  • orders.place_order (cognitive 20) agent/src/trading/connectors/mt5/orders.py:59 — orders.place_order has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 1 (2 pts), error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · sdk.place_order (cognitive 20) · ×1
  • sdk.place_order (cognitive 20) agent/src/trading/connectors/okx/sdk.py:373 — sdk.place_order has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RunnerBudgetControls.RunnerBudgetControls (cognitive 20) · ×1
  • RunnerBudgetControls.RunnerBudgetControls (cognitive 20) frontend/src/components/chat/RunnerBudgetControls.tsx:6 — RunnerBudgetControls.RunnerBudgetControls has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (8 pts), if/else 3, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 49, 39, 54, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · translateElement (cognitive 20) · ×1
  • translateElement (cognitive 20) wiki/site.js:62 — translateElement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), other 5, ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · constraints._build_constraint (cognitive 19) · ×1
  • constraints._build_constraint (cognitive 19) agent/backtest/constraints.py:138 — constraints._build_constraint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine._rebalance (cognitive 19) · ×1
  • BaseEngine._rebalance (cognitive 19) agent/backtest/engines/base.py:1598 — BaseEngine._rebalance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine._write_artifacts (cognitive 19) · ×1
  • BaseEngine._write_artifacts (cognitive 19) agent/backtest/engines/base.py:2352 — BaseEngine._write_artifacts has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (12 pts), loops 3, error handling 1 (2 pts), boolean chains 1, if/else 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qveris_loader._iter_ohlcv_records (cognitive 19) · ×1
  • qveris_loader._iter_ohlcv_records (cognitive 19) agent/backtest/loaders/qveris_loader.py:685 — qveris_loader._iter_ohlcv_records has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 4 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._request_page (cognitive 19) · ×1
  • DataLoader._request_page (cognitive 19) REDACTED:148 — DataLoader._request_page has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, ternaries 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · input._has_unbalanced_brackets (cognitive 19) · ×1
  • input._has_unbalanced_brackets (cognitive 19) agent/cli/input.py:121 — input._has_unbalanced_brackets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main._render_scheduled_proposal (cognitive 19) · ×1
  • main._render_scheduled_proposal (cognitive 19) agent/cli/main.py:1066 — main._render_scheduled_proposal has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), ternaries 3 (6 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 · RailRunDashboard._action_label (cognitive 19) · ×1
  • RailRunDashboard._action_label (cognitive 19) agent/cli/ui/rail.py:556 — RailRunDashboard._action_label has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 7 (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 · FiguresBlock.match (cognitive 19) · ×1
  • FiguresBlock.match (cognitive 19) agent/src/agent/grounding/figures.py:165 — FiguresBlock.match has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ReleaseMixin._provenance_note (cognitive 19) · ×1
  • _ReleaseMixin._provenance_note (cognitive 19) agent/src/agent/grounding/release.py:472 — _ReleaseMixin._provenance_note has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (6 pts), boolean chains 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolCallLifecycle._batch_execute (cognitive 19) · ×1
  • ToolCallLifecycle._batch_execute (cognitive 19) agent/src/agent/tool_lifecycle.py:393 — ToolCallLifecycle._batch_execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · live_routes._fetch_broker_ceilings (cognitive 19) · ×1
  • live_routes._fetch_broker_ceilings (cognitive 19) agent/src/api/live_routes.py:418 — live_routes._fetch_broker_ceilings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (6 pts), error handling 4 (5 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatrixChannel._upload_and_send_attachment (cognitive 19) · ×1
  • MatrixChannel._upload_and_send_attachment (cognitive 19) agent/src/channels/matrix.py:458 — MatrixChannel._upload_and_send_attachment has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 6, error handling 3, ternaries 2. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QQChannel._read_media_bytes (cognitive 19) · ×1
  • QQChannel._read_media_bytes (cognitive 19) agent/src/channels/qq.py:408 — QQChannel._read_media_bytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SignalChannel._strip_bot_mention (cognitive 19) · ×1
  • SignalChannel._strip_bot_mention (cognitive 19) REDACTED:1283 — SignalChannel._strip_bot_mention has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveRunner._run_preemptive_sweep (cognitive 19) · ×1
  • LiveRunner._run_preemptive_sweep (cognitive 19) agent/src/live/runtime/runner.py:624 — LiveRunner._run_preemptive_sweep has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · sdk_order_gate._recover_correlated_fill (cognitive 19) · ×1
  • sdk_order_gate._recover_correlated_fill (cognitive 19) agent/src/live/sdk_order_gate.py:620 — sdk_order_gate._recover_correlated_fill has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, boolean chains 5, error handling 3 (5 pts), ternaries 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 · PersistentMemory.remove (cognitive 19) · ×1
  • PersistentMemory.remove (cognitive 19) agent/src/memory/persistent.py:649 — PersistentMemory.remove has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, error handling 2 (4 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 · OpenBBQueryAdapter._consume_events (cognitive 19) · ×1
  • OpenBBQueryAdapter._consume_events (cognitive 19) agent/src/openbb_bridge/adapter.py:130 — OpenBBQueryAdapter._consume_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceContextInjector._format_widgets (cognitive 19) · ×1
  • WorkspaceContextInjector._format_widgets (cognitive 19) agent/src/openbb_bridge/context_injector.py:269 — WorkspaceContextInjector._format_widgets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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 · PortfolioService.latest (cognitive 19) · ×1
  • PortfolioService.latest (cognitive 19) agent/src/portfolio/service.py:564 — PortfolioService.latest has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), error handling 2 (5 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · preflight._check_llm_provider (cognitive 19) · ×1
  • preflight._check_llm_provider (cognitive 19) agent/src/preflight.py:32 — preflight._check_llm_provider has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · crossvalidation._as_label_spans (cognitive 19) · ×1
  • crossvalidation._as_label_spans (cognitive 19) agent/src/quantlib/crossvalidation.py:110 — crossvalidation._as_label_spans has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 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 · performance._assign_flows_to_periods (cognitive 19) · ×1
  • performance._assign_flows_to_periods (cognitive 19) agent/src/quantlib/performance.py:452 — performance._assign_flows_to_periods has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · triggers.next_cron_due (cognitive 19) · ×1
  • triggers.next_cron_due (cognitive 19) agent/src/scheduling/triggers.py:225 — triggers.next_cron_due has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 3 (6 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · search._search_snippet (cognitive 19) · ×1
  • search._search_snippet (cognitive 19) agent/src/session/search.py:44 — search._search_snippet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4, ternaries 4, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backtester._compute_attribution (cognitive 19) · ×1
  • backtester._compute_attribution (cognitive 19) REDACTED:648 — backtester._compute_attribution has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codegen._rule_to_context (cognitive 19) · ×1
  • codegen._rule_to_context (cognitive 19) agent/src/shadow_account/codegen.py:127 — codegen._rule_to_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · adaptation_workflow.validate_adapted_run (cognitive 19) · ×1
  • adaptation_workflow.validate_adapted_run (cognitive 19) agent/src/strategy_discovery/adaptation_workflow.py:111 — adaptation_workflow.validate_adapted_run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, loops 2, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · grounding.format_grounding_block (cognitive 19) · ×1
  • grounding.format_grounding_block (cognitive 19) agent/src/swarm/grounding.py:231 — grounding.format_grounding_block has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime._rehome_artifact_paths (cognitive 19) · ×1
  • runtime._rehome_artifact_paths (cognitive 19) agent/src/swarm/runtime.py:190 — runtime._rehome_artifact_paths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cashflow_analytics_tool._resolve_flows (cognitive 19) · ×1
  • cashflow_analytics_tool._resolve_flows (cognitive 19) agent/src/tools/cashflow_analytics_tool.py:339 — cashflow_analytics_tool._resolve_flows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fund_flow_tool._fetch_symbol_flow (cognitive 19) · ×1
  • fund_flow_tool._fetch_symbol_flow (cognitive 19) agent/src/tools/fund_flow_tool.py:117 — fund_flow_tool._fetch_symbol_flow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6, boolean chains 2, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · institutional_holdings_tool._list_13f_filings (cognitive 19) · ×1
  • institutional_holdings_tool._list_13f_filings (cognitive 19) agent/src/tools/institutional_holdings_tool.py:569 — institutional_holdings_tool._list_13f_filings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 3 (4 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · institutional_holdings_tool._parse_information_table (cognitive 19) · ×1
  • institutional_holdings_tool._parse_information_table (cognitive 19) agent/src/tools/institutional_holdings_tool.py:721 — institutional_holdings_tool._parse_information_table has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (7 pts), loops 1, ternaries 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · pattern_tool.find_peaks_valleys (cognitive 19) · ×1
  • pattern_tool.find_peaks_valleys (cognitive 19) agent/src/tools/pattern_tool.py:24 — pattern_tool.find_peaks_valleys 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.
D2 · Cognitive Complexity · report_audit_tool.extract_data_points (cognitive 19) · ×1
  • report_audit_tool.extract_data_points (cognitive 19) agent/src/tools/report_audit_tool.py:213 — report_audit_tool.extract_data_points has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sec_filings_tool._parse_filings (cognitive 19) · ×1
  • sec_filings_tool._parse_filings (cognitive 19) agent/src/tools/sec_filings_tool.py:185 — sec_filings_tool._parse_filings has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · strategy_discovery_tool.validate_refresh_entries (cognitive 19) · ×1
  • strategy_discovery_tool.validate_refresh_entries (cognitive 19) agent/src/tools/strategy_discovery_tool.py:495 — strategy_discovery_tool.validate_refresh_entries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk._extract_portfolio_orders (cognitive 19) · ×1
  • sdk._extract_portfolio_orders (cognitive 19) agent/src/trading/connectors/etoro/sdk.py:382 — sdk._extract_portfolio_orders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · orders._build_request (cognitive 19) · ×1
  • orders._build_request (cognitive 19) agent/src/trading/connectors/mt5/orders.py:281 — orders._build_request has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 4 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _EnvReadVisitor.visit_Call (cognitive 19) · ×1
  • _EnvReadVisitor.visit_Call (cognitive 19) tools/ci_env_var_gate.py:118 — _EnvReadVisitor.visit_Call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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 · GoalPanel.GoalPanel (cognitive 19) · ×1
  • GoalPanel.GoalPanel (cognitive 19) frontend/src/components/chat/GoalPanel.tsx:61 — GoalPanel.GoalPanel has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, ternaries 3 (5 pts), if/else 3, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 101, 79, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PortfolioSourceEditor.PortfolioSourceEditor (cognitive 19) · ×1
  • PortfolioSourceEditor.PortfolioSourceEditor (cognitive 19) frontend/src/components/portfolio/PortfolioSourceEditor.tsx:29 — PortfolioSourceEditor.PortfolioSourceEditor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, ternaries 6 (7 pts), boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 108, a function literal at line 35, move, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · api.errorFromResponse (cognitive 19) · ×1
  • api.errorFromResponse (cognitive 19) frontend/src/lib/api.ts:401 — api.errorFromResponse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Runtime.SdkBrokerRuntimeCard (cognitive 19) · ×1
  • Runtime.SdkBrokerRuntimeCard (cognitive 19) frontend/src/pages/Runtime.tsx:302 — Runtime.SdkBrokerRuntimeCard has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · argentina_equity.argentina_sell_allowed (cognitive 18) · ×1
  • argentina_equity.argentina_sell_allowed (cognitive 18) agent/backtest/engines/argentina_equity.py:623 — argentina_equity.argentina_sell_allowed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base._normalise_fundamental_fields (cognitive 18) · ×1
  • base._normalise_fundamental_fields (cognitive 18) agent/backtest/engines/base.py:400 — base._normalise_fundamental_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mt5_loader._ensure_initialized (cognitive 18) · ×1
  • mt5_loader._ensure_initialized (cognitive 18) agent/backtest/loaders/mt5_loader.py:76 — mt5_loader._ensure_initialized has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DataLoader._fetch_one (cognitive 18) · ×1
  • DataLoader._fetch_one (cognitive 18) agent/backtest/loaders/nobitex.py:186 — DataLoader._fetch_one has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._merge_basic_fields (cognitive 18) · ×1
  • DataLoader._merge_basic_fields (cognitive 18) agent/backtest/loaders/tushare.py:276 — DataLoader._merge_basic_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnoverAwareOptimizer.__init__ (cognitive 18) · ×1
  • TurnoverAwareOptimizer.__init__ (cognitive 18) agent/backtest/optimizers/turnover_aware.py:52 — TurnoverAwareOptimizer.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 3, error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · options_payoff._analytic_breakevens (cognitive 18) · ×1
  • options_payoff._analytic_breakevens (cognitive 18) agent/backtest/options_payoff.py:203 — options_payoff._analytic_breakevens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._format_tool_result_preview (cognitive 18) · ×1
  • _legacy._format_tool_result_preview (cognitive 18) agent/cli/_legacy.py:913 — _legacy._format_tool_result_preview has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._handle_slash_command (cognitive 18) · ×1
  • _legacy._handle_slash_command (cognitive 18) agent/cli/_legacy.py:1950 — _legacy._handle_slash_command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_session_chat (cognitive 18) · ×1
  • _legacy.cmd_session_chat (cognitive 18) agent/cli/_legacy.py:2923 — _legacy.cmd_session_chat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.cmd_connector_select_account (cognitive 18) · ×1
  • _legacy.cmd_connector_select_account (cognitive 18) agent/cli/_legacy.py:4660 — _legacy.cmd_connector_select_account has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), boolean chains 2, error handling 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures._entity (cognitive 18) · ×1
  • figures._entity (cognitive 18) agent/src/agent/grounding/figures.py:348 — figures._entity has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures._currency_code_for_figure (cognitive 18) · ×1
  • figures._currency_code_for_figure (cognitive 18) agent/src/agent/grounding/figures.py:1027 — figures._currency_code_for_figure has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · figures._index_cells (cognitive 18) · ×1
  • figures._index_cells (cognitive 18) agent/src/agent/grounding/figures.py:1189 — figures._index_cells has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _IdentityMixin.authorize_tool_call (cognitive 18) · ×1
  • _IdentityMixin.authorize_tool_call (cognitive 18) agent/src/agent/grounding/identity.py:454 — _IdentityMixin.authorize_tool_call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _PolicyMixin._other_call_field_ref_candidates (cognitive 18) · ×1
  • _PolicyMixin._other_call_field_ref_candidates (cognitive 18) agent/src/agent/grounding/policies.py:1259 — _PolicyMixin._other_call_field_ref_candidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llm_usage._normalize_llm_usage (cognitive 18) · ×1
  • llm_usage._normalize_llm_usage (cognitive 18) agent/src/agent/llm_usage.py:35 — llm_usage._normalize_llm_usage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · settings_routes._list_provider_models (cognitive 18) · ×1
  • settings_routes._list_provider_models (cognitive 18) agent/src/api/settings_routes.py:411 — settings_routes._list_provider_models has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MatrixChannel._download_media_bytes (cognitive 18) · ×1
  • MatrixChannel._download_media_bytes (cognitive 18) agent/src/channels/matrix.py:873 — MatrixChannel._download_media_bytes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, error handling 3 (4 pts), loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MochatChannel._refresh_sessions_directory (cognitive 18) · ×1
  • MochatChannel._refresh_sessions_directory (cognitive 18) agent/src/channels/mochat.py:550 — MochatChannel._refresh_sessions_directory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MochatChannel._panel_poll_worker (cognitive 18) · ×1
  • MochatChannel._panel_poll_worker (cognitive 18) agent/src/channels/mochat.py:653 — MochatChannel._panel_poll_worker has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (6 pts), boolean chains 4, error handling 2 (4 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · signal._markdown_to_signal (cognitive 18) · ×1
  • signal._markdown_to_signal (cognitive 18) REDACTED:137 — signal._markdown_to_signal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 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.
D2 · Cognitive Complexity · SlackChannel._resolve_channel_name (cognitive 18) · ×1
  • SlackChannel._resolve_channel_name (cognitive 18) agent/src/channels/slack.py:252 — SlackChannel._resolve_channel_name has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base.zscore_by_group (cognitive 18) · ×1
  • base.zscore_by_group (cognitive 18) agent/src/factors/base.py:99 — base.zscore_by_group has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cli_handlers._emit_detail (cognitive 18) · ×1
  • cli_handlers._emit_detail (cognitive 18) agent/src/hypotheses/cli_handlers.py:105 — cli_handlers._emit_detail has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · enforcement._position_signed_market_value (cognitive 18) · ×1
  • enforcement._position_signed_market_value (cognitive 18) agent/src/live/enforcement.py:420 — enforcement._position_signed_market_value has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortfolioImportStore.create (cognitive 18) · ×1
  • PortfolioImportStore.create (cognitive 18) agent/src/portfolio/imports.py:46 — PortfolioImportStore.create has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · fixedincome.year_fraction (cognitive 18) · ×1
  • fixedincome.year_fraction (cognitive 18) agent/src/quantlib/fixedincome.py:63 — fixedincome.year_fraction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · volatility.heston_price (cognitive 18) · ×1
  • volatility.heston_price (cognitive 18) agent/src/quantlib/volatility.py:111 — volatility.heston_price has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · proposals.commit_proposal (cognitive 18) · ×1
  • proposals.commit_proposal (cognitive 18) agent/src/scheduled_research/proposals.py:172 — proposals.commit_proposal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scanner._iter_selected_targets (cognitive 18) · ×1
  • scanner._iter_selected_targets (cognitive 18) agent/src/security/scanner.py:223 — scanner._iter_selected_targets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evidence_harness.rebuild_evidence (cognitive 18) · ×1
  • evidence_harness.rebuild_evidence (cognitive 18) agent/src/strategy_discovery/evidence_harness.py:589 — evidence_harness.rebuild_evidence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker._classify_deliverable (cognitive 18) · ×1
  • worker._classify_deliverable (cognitive 18) agent/src/swarm/worker.py:1433 — worker._classify_deliverable has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · institutional_holdings_tool._information_table_urls (cognitive 18) · ×1
  • institutional_holdings_tool._information_table_urls (cognitive 18) agent/src/tools/institutional_holdings_tool.py:660 — institutional_holdings_tool._information_table_urls has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data_5m.fetch_five_minute (cognitive 18) · ×1
  • data_5m.fetch_five_minute (cognitive 18) agent/src/tools/paper_trade/data_5m.py:460 — data_5m.fetch_five_minute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data_readiness._assess_five_minute_readiness (cognitive 18) · ×1
  • data_readiness._assess_five_minute_readiness (cognitive 18) agent/src/tools/paper_trade/data_readiness.py:83 — data_readiness._assess_five_minute_readiness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool._resolve_clients (cognitive 18) · ×1
  • tool._resolve_clients (cognitive 18) agent/src/tools/paper_trade/tool.py:154 — tool._resolve_clients has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 6, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wire.received_state_hash_from_payload (cognitive 18) · ×1
  • wire.received_state_hash_from_payload (cognitive 18) agent/src/tools/paper_trade/wire.py:129 — wire.received_state_hash_from_payload has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdf_report.render_markdown_pdf (cognitive 18) · ×1
  • pdf_report.render_markdown_pdf (cognitive 18) agent/src/tools/pdf_report.py:175 — pdf_report.render_markdown_pdf has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · redaction.is_sensitive_arg (cognitive 18) · ×1
  • redaction.is_sensitive_arg (cognitive 18) agent/src/tools/redaction.py:284 — redaction.is_sensitive_arg has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · technical_indicator_tool._extract_series (cognitive 18) · ×1
  • technical_indicator_tool._extract_series (cognitive 18) agent/src/tools/technical_indicator_tool.py:47 — technical_indicator_tool._extract_series has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · sdk._first_rate (cognitive 18) · ×1
  • sdk._first_rate (cognitive 18) agent/src/trading/connectors/etoro/sdk.py:479 — sdk._first_rate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ui_services.load_chart_symbols (cognitive 18) · ×1
  • ui_services.load_chart_symbols (cognitive 18) agent/src/ui_services.py:410 — ui_services.load_chart_symbols has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sync_site_chrome.wiring_problems (cognitive 18) · ×1
  • sync_site_chrome.wiring_problems (cognitive 18) wiki/scripts/sync_site_chrome.py:121 — sync_site_chrome.wiring_problems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update-verification.verifyWindowsUpdateCandidate (cognitive 18) · ×1
  • update-verification.verifyWindowsUpdateCandidate (cognitive 18) desktop/electron/src/update-verification.ts:51 — update-verification.verifyWindowsUpdateCandidate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 5, error handling 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ScheduledResearchProposalCard.ScheduledResearchProposalCard (cognitive 18) · ×1
  • ScheduledResearchProposalCard.ScheduledResearchProposalCard (cognitive 18) frontend/src/components/chat/ScheduledResearchProposalCard.tsx:19 — ScheduledResearchProposalCard.ScheduledResearchProposalCard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 6, error handling 1, if/else 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThinkingTimeline.rebuildLegacyActivity (cognitive 18) · ×1
  • ThinkingTimeline.rebuildLegacyActivity (cognitive 18) frontend/src/components/chat/ThinkingTimeline.tsx:17 — ThinkingTimeline.rebuildLegacyActivity has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 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.
D2 · Cognitive Complexity · positions.parsePositionsPanel (cognitive 18) · ×1
  • positions.parsePositionsPanel (cognitive 18) frontend/src/lib/positions.ts:73 — positions.parsePositionsPanel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.initInstallTabs (cognitive 18) · ×1
  • main.initInstallTabs (cognitive 18) wiki/main.js:4 — main.initInstallTabs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 9). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · binance_account_reconciliation.snapshot_from_binance_usdm_observation (cognitive 17) · ×1
  • binance_account_reconciliation.snapshot_from_binance_usdm_observation (cognitive 17) agent/backtest/binance_account_reconciliation.py:133 — binance_account_reconciliation.snapshot_from_binance_usdm_observation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, error handling 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · correlation.infer_market (cognitive 17) · ×1
  • correlation.infer_market (cognitive 17) agent/backtest/correlation.py:20 — correlation.infer_market has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · correlation._normalize_symbol (cognitive 17) · ×1
  • correlation._normalize_symbol (cognitive 17) agent/backtest/correlation.py:95 — correlation._normalize_symbol has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 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 · BaseEngine._record_dropped_target_adjustments (cognitive 17) · ×1
  • BaseEngine._record_dropped_target_adjustments (cognitive 17) agent/backtest/engines/base.py:1713 — BaseEngine._record_dropped_target_adjustments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base.evaluation_start_index (cognitive 17) · ×1
  • base.evaluation_start_index (cognitive 17) agent/backtest/engines/base.py:175 — base.evaluation_start_index has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ccxt_loader._validate_bracket_artifact (cognitive 17) · ×1
  • ccxt_loader._validate_bracket_artifact (cognitive 17) agent/backtest/loaders/ccxt_loader.py:114 — ccxt_loader._validate_bracket_artifact has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 3 (6 pts), boolean chains 1, loops 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 · fmp_loader._parse_historical (cognitive 17) · ×1
  • fmp_loader._parse_historical (cognitive 17) agent/backtest/loaders/fmp_loader.py:220 — fmp_loader._parse_historical has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DataLoader.fetch (cognitive 17) · ×1
  • DataLoader.fetch (cognitive 17) agent/backtest/loaders/india_broker_loader.py:144 — DataLoader.fetch has cognitive complexity 17 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · local_loader._normalize_columns (cognitive 17) · ×1
  • local_loader._normalize_columns (cognitive 17) agent/backtest/loaders/local_loader.py:182 — local_loader._normalize_columns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · DataLoader._fetch_one (cognitive 17) · ×1
  • DataLoader._fetch_one (cognitive 17) agent/backtest/loaders/qveris_loader.py:395 — DataLoader._fetch_one has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metrics.win_rate_and_stats (cognitive 17) · ×1
  • metrics.win_rate_and_stats (cognitive 17) agent/backtest/metrics.py:343 — metrics.win_rate_and_stats has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, if/else 6 (7 pts), loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BaseOptimizer.optimize (cognitive 17) · ×1
  • BaseOptimizer.optimize (cognitive 17) agent/backtest/optimizers/base.py:36 — BaseOptimizer.optimize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._show_settings (cognitive 17) · ×1
  • _legacy._show_settings (cognitive 17) agent/cli/_legacy.py:1894 — _legacy._show_settings has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (6 pts), boolean chains 5, if/else 4, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _legacy.cmd_swarm_show (cognitive 17) · ×1
  • _legacy.cmd_swarm_show (cognitive 17) agent/cli/_legacy.py:2822 — _legacy.cmd_swarm_show has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._print_channels_status (cognitive 17) · ×1
  • _legacy._print_channels_status (cognitive 17) agent/cli/_legacy.py:3215 — _legacy._print_channels_status has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._handle_prompt_command (cognitive 17) · ×1
  • _legacy._handle_prompt_command (cognitive 17) agent/cli/_legacy.py:5910 — _legacy._handle_prompt_command has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (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 · RailRunDashboard._active_step (cognitive 17) · ×1
  • RailRunDashboard._active_step (cognitive 17) agent/cli/ui/rail.py:463 — RailRunDashboard._active_step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HarnessCase.from_dict (cognitive 17) · ×1
  • HarnessCase.from_dict (cognitive 17) agent/evals/harness/schema.py:33 — HarnessCase.from_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _PolicyMixin._unknown_call_field_ref_candidates (cognitive 17) · ×1
  • _PolicyMixin._unknown_call_field_ref_candidates (cognitive 17) agent/src/agent/grounding/policies.py:1310 — _PolicyMixin._unknown_call_field_ref_candidates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, loops 2, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · policies._records_at (cognitive 17) · ×1
  • policies._records_at (cognitive 17) agent/src/agent/grounding/policies.py:2595 — policies._records_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 2 (3 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _ReleaseMixin.correction_prompt (cognitive 17) · ×1
  • _ReleaseMixin.correction_prompt (cognitive 17) agent/src/agent/grounding/release.py:176 — _ReleaseMixin.correction_prompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 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.
D2 · Cognitive Complexity · skills.split_sections (cognitive 17) · ×1
  • skills.split_sections (cognitive 17) agent/src/agent/skills.py:230 — skills.split_sections has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool_results._archive_backtest_result (cognitive 17) · ×1
  • tool_results._archive_backtest_result (cognitive 17) agent/src/agent/tool_results.py:184 — tool_results._archive_backtest_result has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, error handling 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attribution_core._attribution_factor_section (cognitive 17) · ×1
  • attribution_core._attribution_factor_section (cognitive 17) agent/src/api/attribution_core.py:361 — attribution_core._attribution_factor_section has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cvm_companies.parse_statement (cognitive 17) · ×1
  • cvm_companies.parse_statement (cognitive 17) agent/src/br_data/cvm_companies.py:81 — cvm_companies.parse_statement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelRuntime._wait_for_reply (cognitive 17) · ×1
  • ChannelRuntime._wait_for_reply (cognitive 17) agent/src/channels/runtime.py:372 — ChannelRuntime._wait_for_reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackChannel._resolve_user_handle (cognitive 17) · ×1
  • SlackChannel._resolve_user_handle (cognitive 17) agent/src/channels/slack.py:284 — SlackChannel._resolve_user_handle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramChannel._try_send_rich (cognitive 17) · ×1
  • TelegramChannel._try_send_rich (cognitive 17) agent/src/channels/telegram.py:695 — TelegramChannel._try_send_rich has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ingest._resolve_columns (cognitive 17) · ×1
  • ingest._resolve_columns (cognitive 17) agent/src/entities/ingest.py:89 — ingest._resolve_columns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ingest._resolve_panel_long_columns) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ingest._resolve_panel_long_columns (cognitive 17) · ×1
  • ingest._resolve_panel_long_columns (cognitive 17) agent/src/entities/ingest.py:743 — ingest._resolve_panel_long_columns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ingest._resolve_columns) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · flatten._flatten_open_positions (cognitive 17) · ×1
  • flatten._flatten_open_positions (cognitive 17) agent/src/live/runtime/flatten.py:321 — flatten._flatten_open_positions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalization.account_cash_usd (cognitive 17) · ×1
  • normalization.account_cash_usd (cognitive 17) agent/src/portfolio/normalization.py:337 — normalization.account_cash_usd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, loops 1 (2 pts), ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai_codex._convert_user_message (cognitive 17) · ×1
  • openai_codex._convert_user_message (cognitive 17) agent/src/providers/openai_codex.py:438 — openai_codex._convert_user_message has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · playbooks.load_playbook_file (cognitive 17) · ×1
  • playbooks.load_playbook_file (cognitive 17) agent/src/scheduled_research/playbooks.py:275 — playbooks.load_playbook_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 6, error handling 2, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · backtester.run_shadow_backtest (cognitive 17) · ×1
  • backtester.run_shadow_backtest (cognitive 17) REDACTED:164 — backtester.run_shadow_backtest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 4 (6 pts), boolean chains 3, ternaries 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · pdf_fallback.render_pdf_reportlab (cognitive 17) · ×1
  • pdf_fallback.render_pdf_reportlab (cognitive 17) REDACTED:72 — pdf_fallback.render_pdf_reportlab has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 1, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SignalEngine.generate (cognitive 17) · ×1
  • SignalEngine.generate (cognitive 17) agent/src/skills/event-driven/example_signal_engine.py:39 — SignalEngine.generate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (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 · run_artifacts.read_equity_series (cognitive 17) · ×1
  • run_artifacts.read_equity_series (cognitive 17) agent/src/strategy_discovery/run_artifacts.py:235 — run_artifacts.read_equity_series has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 3 (5 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp.compact_result_for_agent (cognitive 17) · ×1
  • mcp.compact_result_for_agent (cognitive 17) agent/src/tools/mcp.py:1254 — mcp.compact_result_for_agent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data._resolve_network_loader (cognitive 17) · ×1
  • data._resolve_network_loader (cognitive 17) agent/src/tools/paper_trade/data.py:269 — data._resolve_network_loader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · strategy_exec.run_strategy_path (cognitive 17) · ×1
  • strategy_exec.run_strategy_path (cognitive 17) agent/src/tools/paper_trade/strategy_exec.py:504 — strategy_exec.run_strategy_path has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, error handling 3 (5 pts), ternaries 3 (5 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 · pattern_tool.double_top_bottom (cognitive 17) · ×1
  • pattern_tool.double_top_bottom (cognitive 17) agent/src/tools/pattern_tool.py:201 — pattern_tool.double_top_bottom has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pattern_tool.run_pattern (cognitive 17) · ×1
  • pattern_tool.run_pattern (cognitive 17) agent/src/tools/pattern_tool.py:331 — pattern_tool.run_pattern has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), error handling 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trade_journal_parsers._ths_datetime (cognitive 17) · ×1
  • trade_journal_parsers._ths_datetime (cognitive 17) agent/src/tools/trade_journal_parsers.py:380 — trade_journal_parsers._ths_datetime has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trade_journal_tool._apply_filter (cognitive 17) · ×1
  • trade_journal_tool._apply_filter (cognitive 17) agent/src/tools/trade_journal_tool.py:597 — trade_journal_tool._apply_filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), error handling 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 · sdk.search_instruments (cognitive 17) · ×1
  • sdk.search_instruments (cognitive 17) agent/src/trading/connectors/binance/sdk.py:421 — sdk.search_instruments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · instruments._rates_by_instrument_id (cognitive 17) · ×1
  • instruments._rates_by_instrument_id (cognitive 17) agent/src/trading/connectors/etoro/instruments.py:458 — instruments._rates_by_instrument_id has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk._normalize_candles (cognitive 17) · ×1
  • sdk._normalize_candles (cognitive 17) agent/src/trading/connectors/etoro/sdk.py:508 — sdk._normalize_candles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 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.
D2 · Cognitive Complexity · sdk.get_open_orders (cognitive 17) · ×1
  • sdk.get_open_orders (cognitive 17) agent/src/trading/connectors/kis/sdk.py:318 — sdk.get_open_orders has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.cancel_order (cognitive 17) · ×1
  • sdk.cancel_order (cognitive 17) agent/src/trading/connectors/kis/sdk.py:562 — sdk.cancel_order has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · service._sdk_config (cognitive 17) · ×1
  • service._sdk_config (cognitive 17) agent/src/trading/service.py:81 — service._sdk_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ci_env_var_gate._collect_python_files (cognitive 17) · ×1
  • ci_env_var_gate._collect_python_files (cognitive 17) tools/ci_env_var_gate.py:199 — ci_env_var_gate._collect_python_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 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.
D2 · Cognitive Complexity · ConfirmDialog.ConfirmDialog (cognitive 17) · ×1
  • ConfirmDialog.ConfirmDialog (cognitive 17) frontend/src/components/common/ConfirmDialog.tsx:25 — ConfirmDialog.ConfirmDialog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 2. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 48, 42, 78). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RunDetail.StudioTab (cognitive 17) · ×1
  • RunDetail.StudioTab (cognitive 17) frontend/src/pages/RunDetail.tsx:622 — RunDetail.StudioTab has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · benchmark._infer_market (cognitive 16) · ×1
  • benchmark._infer_market (cognitive 16) agent/backtest/benchmark.py:163 — benchmark._infer_market has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ArgentinaEquityEngine.__init__ (cognitive 16) · ×1
  • ArgentinaEquityEngine.__init__ (cognitive 16) agent/backtest/engines/argentina_equity.py:389 — ArgentinaEquityEngine.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · BaseEngine._weighted_holding_bars (cognitive 16) · ×1
  • BaseEngine._weighted_holding_bars (cognitive 16) agent/backtest/engines/base.py:2310 — BaseEngine._weighted_holding_bars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · factor_costs.rebalance_cost (cognitive 16) · ×1
  • factor_costs.rebalance_cost (cognitive 16) agent/backtest/factor_costs.py:297 — factor_costs.rebalance_cost has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (7 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loader_health.check_frame (cognitive 16) · ×1
  • loader_health.check_frame (cognitive 16) agent/backtest/loader_health.py:147 — loader_health.check_frame has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · gildata_codes.resolve_vendor_code (cognitive 16) · ×1
  • gildata_codes.resolve_vendor_code (cognitive 16) agent/backtest/loaders/gildata_codes.py:89 — gildata_codes.resolve_vendor_code has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DataLoader._paginate (cognitive 16) · ×1
  • DataLoader._paginate (cognitive 16) agent/backtest/loaders/okx.py:267 — DataLoader._paginate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 3, loops 3, ternaries 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rsshub_events.enrich_price_frames_with_events (cognitive 16) · ×1
  • rsshub_events.enrich_price_frames_with_events (cognitive 16) REDACTED:525 — rsshub_events.enrich_price_frames_with_events has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader.fetch (cognitive 16) · ×1
  • DataLoader.fetch (cognitive 16) REDACTED:80 — DataLoader.fetch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 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 · options_payoff._validate_legs (cognitive 16) · ×1
  • options_payoff._validate_legs (cognitive 16) agent/backtest/options_payoff.py:77 — options_payoff._validate_legs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · perpetual_risk._position_risks (cognitive 16) · ×1
  • perpetual_risk._position_risks (cognitive 16) agent/backtest/perpetual_risk.py:284 — perpetual_risk._position_risks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_card._normalize_tool_traces (cognitive 16) · ×1
  • run_card._normalize_tool_traces (cognitive 16) agent/backtest/run_card.py:412 — run_card._normalize_tool_traces has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._validate_signal_engine_source (cognitive 16) · ×1
  • runner._validate_signal_engine_source (cognitive 16) agent/backtest/runner.py:791 — runner._validate_signal_engine_source has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy._build_benchmark_table (cognitive 16) · ×1
  • _legacy._build_benchmark_table (cognitive 16) agent/cli/_legacy.py:1351 — _legacy._build_benchmark_table has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · main._print_interactive_result (cognitive 16) · ×1
  • main._print_interactive_result (cognitive 16) agent/cli/main.py:780 — main._print_interactive_result has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_compact._microcompact (cognitive 16) · ×1
  • context_compact._microcompact (cognitive 16) agent/src/agent/context_compact.py:227 — context_compact._microcompact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · figures._writes_decimal_commas (cognitive 16) · ×1
  • figures._writes_decimal_commas (cognitive 16) agent/src/agent/grounding/figures.py:578 — figures._writes_decimal_commas has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 2 (5 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · attribution_core._attribution_load_equity (cognitive 16) · ×1
  • attribution_core._attribution_load_equity (cognitive 16) agent/src/api/attribution_core.py:173 — attribution_core._attribution_load_equity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers._write_env_values (cognitive 16) · ×1
  • helpers._write_env_values (cognitive 16) agent/src/api/helpers.py:208 — helpers._write_env_values has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessions_routes._strip_prompt_wrappers (cognitive 16) · ×1
  • sessions_routes._strip_prompt_wrappers (cognitive 16) agent/src/api/sessions_routes.py:56 — sessions_routes._strip_prompt_wrappers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cotahist.sync (cognitive 16) · ×1
  • cotahist.sync (cognitive 16) agent/src/br_data/cotahist.py:157 — cotahist.sync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cvm_funds.sync_daily (cognitive 16) · ×1
  • cvm_funds.sync_daily (cognitive 16) agent/src/br_data/cvm_funds.py:151 — cvm_funds.sync_daily has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DingTalkChannel._send_media_ref (cognitive 16) · ×1
  • DingTalkChannel._send_media_ref (cognitive 16) agent/src/channels/dingtalk.py:620 — DingTalkChannel._send_media_ref has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · DiscordChannel._should_respond_in_group (cognitive 16) · ×1
  • DiscordChannel._should_respond_in_group (cognitive 16) agent/src/channels/discord.py:763 — DiscordChannel._should_respond_in_group has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 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 · EmailChannel._select_trusted_authentication_results (cognitive 16) · ×1
  • EmailChannel._select_trusted_authentication_results (cognitive 16) agent/src/channels/email.py:1002 — EmailChannel._select_trusted_authentication_results has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannel._extract_attachments (cognitive 16) · ×1
  • EmailChannel._extract_attachments (cognitive 16) agent/src/channels/email.py:1156 — EmailChannel._extract_attachments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 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 · FeishuChannel._resolve_mentions (cognitive 16) · ×1
  • FeishuChannel._resolve_mentions (cognitive 16) agent/src/channels/feishu.py:903 — FeishuChannel._resolve_mentions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 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.
D2 · Cognitive Complexity · MatrixChannel.send (cognitive 16) · ×1
  • MatrixChannel.send (cognitive 16) agent/src/channels/matrix.py:512 — MatrixChannel.send has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MochatChannel._handle_watch_payload (cognitive 16) · ×1
  • MochatChannel._handle_watch_payload (cognitive 16) agent/src/channels/mochat.py:682 — MochatChannel._handle_watch_payload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MochatChannel._process_inbound_event (cognitive 16) · ×1
  • MochatChannel._process_inbound_event (cognitive 16) agent/src/channels/mochat.py:712 — MochatChannel._process_inbound_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TelegramChannel._drain_ordered_updates (cognitive 16) · ×1
  • TelegramChannel._drain_ordered_updates (cognitive 16) agent/src/channels/telegram.py:1385 — TelegramChannel._drain_ordered_updates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (5 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WeixinChannel._send_media_file (cognitive 16) · ×1
  • WeixinChannel._send_media_file (cognitive 16) REDACTED:1328 — WeixinChannel._send_media_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · whatsapp._media_message (cognitive 16) · ×1
  • whatsapp._media_message (cognitive 16) agent/src/channels/whatsapp.py:215 — whatsapp._media_message has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MCPServerConfig.validate_transport_config (cognitive 16) · ×1
  • MCPServerConfig.validate_transport_config (cognitive 16) agent/src/config/schema.py:420 — MCPServerConfig.validate_transport_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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 · CashFlowSeries.__post_init__ (cognitive 16) · ×1
  • CashFlowSeries.__post_init__ (cognitive 16) agent/src/entities/cashflow.py:223 — CashFlowSeries.__post_init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bench_runner_strict.categorise_strict (cognitive 16) · ×1
  • bench_runner_strict.categorise_strict (cognitive 16) agent/src/factors/bench_runner_strict.py:244 — bench_runner_strict.categorise_strict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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 · sdk_order_gate.execute_live_order (cognitive 16) · ×1
  • sdk_order_gate.execute_live_order (cognitive 16) agent/src/live/sdk_order_gate.py:62 — sdk_order_gate.execute_live_order has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MemoryLifecycle._write_compressed (cognitive 16) · ×1
  • MemoryLifecycle._write_compressed (cognitive 16) agent/src/memory/lifecycle.py:352 — MemoryLifecycle._write_compressed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · capabilities.get_llm_credentials (cognitive 16) · ×1
  • capabilities.get_llm_credentials (cognitive 16) agent/src/providers/capabilities.py:386 — capabilities.get_llm_credentials has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · chat._parse_dsml_tool_calls (cognitive 16) · ×1
  • chat._parse_dsml_tool_calls (cognitive 16) agent/src/providers/chat.py:286 — chat._parse_dsml_tool_calls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 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 · fundmath.preferred_return_amount (cognitive 16) · ×1
  • fundmath.preferred_return_amount (cognitive 16) agent/src/quantlib/fundmath.py:922 — fundmath.preferred_return_amount has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 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.
D2 · Cognitive Complexity · var_backtest._align (cognitive 16) · ×1
  • var_backtest._align (cognitive 16) agent/src/quantlib/var_backtest.py:236 — var_backtest._align has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 4, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · system_jobs.ensure_system_jobs (cognitive 16) · ×1
  • system_jobs.ensure_system_jobs (cognitive 16) agent/src/scheduling/system_jobs.py:420 — system_jobs.ensure_system_jobs has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 3 (7 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 · ZooSignalEngine.generate (cognitive 16) · ×1
  • ZooSignalEngine.generate (cognitive 16) agent/src/skills/multi-factor/zoo_signal_engine.py:251 — ZooSignalEngine.generate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · models.coverage_days_from_ranges (cognitive 16) · ×1
  • models.coverage_days_from_ranges (cognitive 16) agent/src/strategy_discovery/models.py:227 — models.coverage_days_from_ranges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metrics.compute_decay_metrics (cognitive 16) · ×1
  • metrics.compute_decay_metrics (cognitive 16) agent/src/strategy_store/metrics.py:29 — metrics.compute_decay_metrics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · alpha_bench_tool._render_html_manual (cognitive 16) · ×1
  • alpha_bench_tool._render_html_manual (cognitive 16) agent/src/tools/alpha_bench_tool.py:1162 — alpha_bench_tool._render_html_manual has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (6 pts), if/else 4 (5 pts), ternaries 1 (3 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 · backtest_runs_tool._backtests_of (cognitive 16) · ×1
  • backtest_runs_tool._backtests_of (cognitive 16) agent/src/tools/backtest_runs_tool.py:62 — backtest_runs_tool._backtests_of has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backtest_tool._record_bench_if_declared (cognitive 16) · ×1
  • backtest_tool._record_bench_if_declared (cognitive 16) agent/src/tools/backtest_tool.py:106 — backtest_tool._record_bench_if_declared has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · etf_holdings_tool._cn_periodic_reports (cognitive 16) · ×1
  • etf_holdings_tool._cn_periodic_reports (cognitive 16) agent/src/tools/etf_holdings_tool.py:1044 — etf_holdings_tool._cn_periodic_reports has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, error handling 1, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options_payoff_tool._coerce_legs (cognitive 16) · ×1
  • options_payoff_tool._coerce_legs (cognitive 16) agent/src/tools/options_payoff_tool.py:233 — options_payoff_tool._coerce_legs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prediction_market_tool._market_resolution (cognitive 16) · ×1
  • prediction_market_tool._market_resolution (cognitive 16) agent/src/tools/prediction_market_tool.py:350 — prediction_market_tool._market_resolution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · prediction_market_tool._resolve_history_token (cognitive 16) · ×1
  • prediction_market_tool._resolve_history_token (cognitive 16) agent/src/tools/prediction_market_tool.py:777 — prediction_market_tool._resolve_history_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · redaction.redact_internal_paths (cognitive 16) · ×1
  • redaction.redact_internal_paths (cognitive 16) agent/src/tools/redaction.py:232 — redaction.redact_internal_paths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · research_papers_tool._admits_metric (cognitive 16) · ×1
  • research_papers_tool._admits_metric (cognitive 16) agent/src/tools/research_papers_tool.py:530 — research_papers_tool._admits_metric has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_artifact_tool.read_run_artifact (cognitive 16) · ×1
  • run_artifact_tool.read_run_artifact (cognitive 16) agent/src/tools/run_artifact_tool.py:450 — run_artifact_tool.read_run_artifact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, error handling 5 (6 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · symbol_search_tool._merge_candidates (cognitive 16) · ×1
  • symbol_search_tool._merge_candidates (cognitive 16) agent/src/tools/symbol_search_tool.py:916 — symbol_search_tool._merge_candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.place_order (cognitive 16) · ×1
  • sdk.place_order (cognitive 16) agent/src/trading/connectors/dhan/sdk.py:439 — sdk.place_order has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 2, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · instruments._alias_tokens_for_type (cognitive 16) · ×1
  • instruments._alias_tokens_for_type (cognitive 16) agent/src/trading/connectors/etoro/instruments.py:125 — instruments._alias_tokens_for_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trading.place_order (cognitive 16) · ×1
  • trading.place_order (cognitive 16) agent/src/trading/connectors/etoro/trading.py:32 — trading.place_order has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 2, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · service._call_remote (cognitive 16) · ×1
  • service._call_remote (cognitive 16) agent/src/trading/service.py:1516 — service._call_remote has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ui_services.build_indicator_series (cognitive 16) · ×1
  • ui_services.build_indicator_series (cognitive 16) agent/src/ui_services.py:309 — ui_services.build_indicator_series has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ui_services.build_run_analysis (cognitive 16) · ×1
  • ui_services.build_run_analysis (cognitive 16) agent/src/ui_services.py:491 — ui_services.build_run_analysis has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ActivityLine.ActivityLine (cognitive 16) · ×1
  • ActivityLine.ActivityLine (cognitive 16) frontend/src/components/chat/ActivityLine.tsx:62 — ActivityLine.ActivityLine has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 2. Of this number, 8 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ToolProgressIndicator.ToolProgressIndicator (cognitive 16) · ×1
  • ToolProgressIndicator.ToolProgressIndicator (cognitive 16) frontend/src/components/chat/ToolProgressIndicator.tsx:230 — ToolProgressIndicator.ToolProgressIndicator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, loops 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 235, 264, 256). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SidebarNavigation.SidebarNavigation (cognitive 16) · ×1
  • SidebarNavigation.SidebarNavigation (cognitive 16) frontend/src/components/layout/SidebarNavigation.tsx:8 — SidebarNavigation.SidebarNavigation has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 4, if/else 3. Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 44, 40, 20, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · tearsheet.computeTopDrawdowns (cognitive 16) · ×1
  • tearsheet.computeTopDrawdowns (cognitive 16) frontend/src/lib/tearsheet.ts:189 — tearsheet.computeTopDrawdowns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Portfolio.HistoryChart (cognitive 16) · ×1
  • Portfolio.HistoryChart (cognitive 16) frontend/src/pages/Portfolio.tsx:672 — Portfolio.HistoryChart has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 1, if/else 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 693, 676, 689). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Runtime.BrokerRuntimeCard (cognitive 16) · ×1
  • Runtime.BrokerRuntimeCard (cognitive 16) frontend/src/pages/Runtime.tsx:227 — Runtime.BrokerRuntimeCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 2, if/else 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.
D32 · Data Compliance (PII/GDPR) · REDACTED · ×1
  • REDACTED
D35 · Change Coupling · Change coupling · ×1
  • Change coupling: api.ts ↔ router.tsx frontend/src/lib/api.ts:1 — `frontend/src/lib/api.ts` and `frontend/src/router.tsx` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `dad36b50` feat: add Options Lab panel with payoff diagram, spot-IV scenarios, G…; `516ae67e` feat(scheduled-research): add timezone-aware local schedules (#954); `8f7dc0aa` feat(reports): add backtest report library page (#224) — run `git show` on any of them.
D4 · Code Duplication · Near-duplicate member family (10 members, 11 shared lines) · ×1
  • Near-duplicate member family (10 members, 11 shared lines) agent/src/factors/zoo/alpha101/alpha_007.py:60 — agent/src/factors/zoo/alpha101/alpha_007.py:60-77 | agent/src/factors/zoo/alpha101/alpha_009.py:55-72 | agent/src/factors/zoo/alpha101/alpha_010.py:55-72 | agent/src/factors/zoo/alpha101/alpha_021.py:65-82 | agent/src/factors/zoo/alpha101/alpha_023.py:60-77 | agent/src/factors/zoo/alpha101/alpha_024.py:67-84 | agent/src/factors/zoo/alpha101/alpha_027.py:65-82 | agent/src/factors/zoo/alpha101/alpha_046.py:67-84 | agent/src/factors/zoo/alpha101/alpha_049.py:67-84 | agent/src/factors/zoo/alpha101/alpha_051.py:67-84 — These 10 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 44 shared lines) · ×1
  • Near-duplicate member family (3 members, 44 shared lines) agent/backtest/loaders/akshare_loader.py:135 — agent/backtest/loaders/akshare_loader.py:135-194 | agent/backtest/loaders/eastmoney_loader.py:80-149 | REDACTED:89-146 — These 3 members are variants of one another: a block of 44 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) agent/src/factors/zoo/gtja191/alpha_172.py:54 — agent/src/factors/zoo/gtja191/alpha_172.py:54-81 | agent/src/factors/zoo/gtja191/alpha_186.py:54-82 — 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 (15 corresponding lines) · ×1
  • Edited copy of a member (15 corresponding lines) agent/src/factors/zoo/gtja191/alpha_049.py:49 — agent/src/factors/zoo/gtja191/alpha_049.py:49-64 | agent/src/factors/zoo/gtja191/alpha_050.py:49-65 — 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 copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) agent/src/strategy_store/sqlite_store.py:379 — agent/src/strategy_store/sqlite_store.py:379-456 | agent/src/strategy_store/sqlite_store.py:554-619 — 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 copy of a member (19 corresponding lines) · ×1
  • Edited copy of a member (19 corresponding lines) agent/src/factors/zoo/gtja191/alpha_161.py:54 — agent/src/factors/zoo/gtja191/alpha_161.py:54-72 | agent/src/factors/zoo/gtja191/alpha_175.py:54-72 — 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) · ×1
  • Edited copy of a member (21 corresponding lines) agent/src/tools/pattern_tool.py:236 — agent/src/tools/pattern_tool.py:236-267 | agent/src/tools/pattern_tool.py:271-296 — 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 (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) agent/src/tools/autopilot_tool.py:461 — agent/src/tools/autopilot_tool.py:461-539 | agent/src/tools/autopilot_tool.py:580-675 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×1
  • Edited copy of a member (26 corresponding lines) agent/src/tools/get_fundamentals_tool.py:127 — agent/src/tools/get_fundamentals_tool.py:127-210 | agent/src/tools/market_data_tool.py:158-245 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (18 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (18 members, 50+ identical tokens) agent/src/factors/zoo/alpha101/alpha_048.py:67 — agent/src/factors/zoo/alpha101/alpha_048.py:67-94 | agent/src/factors/zoo/alpha101/alpha_058.py:55-82 | agent/src/factors/zoo/alpha101/alpha_059.py:55-82 | agent/src/factors/zoo/alpha101/alpha_063.py:60-87 | agent/src/factors/zoo/alpha101/alpha_067.py:55-82 | agent/src/factors/zoo/alpha101/alpha_069.py:55-82 | agent/src/factors/zoo/alpha101/alpha_070.py:55-82 | agent/src/factors/zoo/alpha101/alpha_076.py:56-83 | agent/src/factors/zoo/alpha101/alpha_079.py:56-83 | agent/src/factors/zoo/alpha101/alpha_080.py:55-82 | agent/src/factors/zoo/alpha101/alpha_082.py:56-83 | agent/src/factors/zoo/alpha101/alpha_087.py:56-83 | agent/src/factors/zoo/alpha101/alpha_089.py:55-82 | agent/src/factors/zoo/alpha101/alpha_090.py:55-82 | agent/src/factors/zoo/alpha101/alpha_091.py:55-82 | agent/src/factors/zoo/alpha101/alpha_093.py:55-82 | agent/src/factors/zoo/alpha101/alpha_097.py:55-82 | agent/src/factors/zoo/alpha101/alpha_100.py:55-82 — These 18 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 18 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 18 times.
D4 · Code Duplication · Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) agent/src/factors/zoo/academic/bab.py:53 — agent/src/factors/zoo/academic/bab.py:53-58 | agent/src/factors/zoo/academic/carhart_mom.py:48-53 | agent/src/factors/zoo/academic/cma.py:48-53 | agent/src/factors/zoo/academic/corr_rewire.py:151-156 | agent/src/factors/zoo/academic/high52w.py:47-52 | agent/src/factors/zoo/academic/hml.py:48-53 | agent/src/factors/zoo/academic/illiq.py:47-52 | agent/src/factors/zoo/academic/mkt_rf.py:45-52 | agent/src/factors/zoo/academic/retskew.py:47-52 | agent/src/factors/zoo/academic/rmw.py:47-52 | agent/src/factors/zoo/academic/smb.py:46-51 | agent/src/factors/zoo/academic/strev.py:46-51 — These 12 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 12 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 12 times.
D4 · Code Duplication · Duplicated block (51–54 lines × 2) · ×1
  • Duplicated block (51–54 lines × 2) agent/src/factors/bench_runner.py:383 — agent/src/factors/bench_runner.py:383-433 | agent/src/factors/bench_runner_strict.py:613-666 — 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 `agent/src/factors/bench_runner.py:383` it does not close everything it opens, so those 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, `agent/src/factors/bench_runner_strict.py:612` calls `sorted` and `agent/src/factors/bench_runner.py:381` 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 (37–45 lines × 2) · ×1
  • Duplicated block (37–45 lines × 2) agent/backtest/loaders/akshare_loader.py:135 — agent/backtest/loaders/akshare_loader.py:135-171 | agent/backtest/loaders/eastmoney_loader.py:80-124 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/akshare_loader.py:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–45 lines × 2) · ×1
  • Duplicated block (43–45 lines × 2) agent/backtest/loaders/fmp_loader.py:265 — agent/backtest/loaders/fmp_loader.py:265-309 | agent/backtest/loaders/tiingo_loader.py:197-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34–38 lines × 2) · ×1
  • Duplicated block (34–38 lines × 2) agent/src/quantlib/crossvalidation.py:233 — agent/src/quantlib/crossvalidation.py:233-266 | agent/src/quantlib/crossvalidation.py:424-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (4–35 lines × 3) · ×1
  • Duplicated block (4–35 lines × 3) agent/backtest/engines/base.py:710 — agent/backtest/engines/base.py:710-713 | agent/backtest/engines/korea_equity.py:231-265 | agent/backtest/engines/vietnam_equity.py:224-257 — before extracting anything, compare `agent/backtest/engines/korea_equity.py` and `agent/backtest/engines/vietnam_equity.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 (27–34 lines × 2) · ×1
  • Duplicated block (27–34 lines × 2) agent/src/quantlib/risk.py:255 — agent/src/quantlib/risk.py:255-281 | agent/src/quantlib/risk.py:329-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–33 lines × 2) · ×1
  • Duplicated block (25–33 lines × 2) agent/src/api/attribution_routes.py:40 — agent/src/api/attribution_routes.py:40-72 | agent/src/api/runs_routes.py:846-870 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (25–30 lines × 2) · ×1
  • Duplicated block (25–30 lines × 2) agent/src/agent/grounding/identity.py:269 — agent/src/agent/grounding/identity.py:269-298 | agent/src/agent/grounding/identity.py:372-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–29 lines × 4) · ×1
  • Duplicated block (27–29 lines × 4) agent/src/trading/connectors/dhan/sdk.py:537 — agent/src/trading/connectors/dhan/sdk.py:537-565 | agent/src/trading/connectors/shoonya/sdk.py:510-538 | agent/src/trading/connectors/upbit/sdk.py:508-536 | agent/src/trading/connectors/zerodha/sdk.py:633-659 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28 lines × 18) · ×1
  • Duplicated block (28 lines × 18) agent/src/factors/zoo/alpha101/alpha_048.py:67 — agent/src/factors/zoo/alpha101/alpha_048.py:67-94 | agent/src/factors/zoo/alpha101/alpha_058.py:55-82 | agent/src/factors/zoo/alpha101/alpha_059.py:55-82 | agent/src/factors/zoo/alpha101/alpha_063.py:60-87 | agent/src/factors/zoo/alpha101/alpha_067.py:55-82 | agent/src/factors/zoo/alpha101/alpha_069.py:55-82 | agent/src/factors/zoo/alpha101/alpha_070.py:55-82 | agent/src/factors/zoo/alpha101/alpha_076.py:56-83 | agent/src/factors/zoo/alpha101/alpha_079.py:56-83 | agent/src/factors/zoo/alpha101/alpha_080.py:55-82 | agent/src/factors/zoo/alpha101/alpha_082.py:56-83 | agent/src/factors/zoo/alpha101/alpha_087.py:56-83 | agent/src/factors/zoo/alpha101/alpha_089.py:55-82 | agent/src/factors/zoo/alpha101/alpha_090.py:55-82 | agent/src/factors/zoo/alpha101/alpha_091.py:55-82 | agent/src/factors/zoo/alpha101/alpha_093.py:55-82 | agent/src/factors/zoo/alpha101/alpha_097.py:55-82 | agent/src/factors/zoo/alpha101/alpha_100.py:55-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 18 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/factors/zoo/alpha101/alpha_063.py:54` calls `_rolling_sum`, `rolling`, `sum` and `agent/src/factors/zoo/alpha101/alpha_058.py:51` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) agent/src/quantlib/credit.py:296 — agent/src/quantlib/credit.py:296-327 | agent/src/quantlib/credit.py:419-446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×1
  • Duplicated block (26–28 lines × 2) agent/src/trading/connectors/dhan/sdk.py:453 — agent/src/trading/connectors/dhan/sdk.py:453-480 | agent/src/trading/connectors/shoonya/sdk.py:434-459 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–27 lines × 5) · ×1
  • Duplicated block (24–27 lines × 5) agent/src/skills/elliott-wave/example_signal_engine.py:414 — agent/src/skills/elliott-wave/example_signal_engine.py:414-440 | agent/src/skills/harmonic/example_signal_engine.py:431-457 | agent/src/skills/ichimoku/example_signal_engine.py:135-161 | agent/src/skills/smc/example_signal_engine.py:26-49 | agent/src/skills/technical-basic/example_signal_engine.py:250-273 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) agent/backtest/loaders/nobitex.py:158 — agent/backtest/loaders/nobitex.py:158-184 | agent/backtest/loaders/wallex.py:156-182 — before extracting anything, compare `agent/backtest/loaders/nobitex.py` and `agent/backtest/loaders/wallex.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/nobitex.py:158` it begins part-way through the construct above it, so those 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, `agent/backtest/loaders/nobitex.py:157` calls `sorted` and `agent/backtest/loaders/wallex.py:155` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–27 lines × 2) · ×1
  • Duplicated block (14–27 lines × 2) agent/src/tools/orderbook_depth_tool.py:177 — agent/src/tools/orderbook_depth_tool.py:177-190 | agent/src/tools/prediction_market_tool.py:948-974 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–27 lines × 2) · ×1
  • Duplicated block (22–27 lines × 2) agent/src/trading/connectors/robinhood/mcp.py:484 — agent/src/trading/connectors/robinhood/mcp.py:484-510 | agent/src/trading/connectors/robinhood/mcp.py:531-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–26 lines × 4) · ×1
  • Duplicated block (20–26 lines × 4) agent/src/trading/connectors/binance/sdk.py:219 — agent/src/trading/connectors/binance/sdk.py:219-244 | agent/src/trading/connectors/dhan/sdk.py:198-217 | agent/src/trading/connectors/tiger/sdk.py:189-210 | agent/src/trading/connectors/upbit/sdk.py:192-211 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `BinanceConfig | None = None` in one and `DhanConfig | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (12–26 lines × 2) · ×1
  • Duplicated block (12–26 lines × 2) agent/cli/_legacy.py:968 — agent/cli/_legacy.py:968-993 | agent/src/api/sessions_routes.py:263-274 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–26 lines × 2) · ×1
  • Duplicated block (14–26 lines × 2) agent/cli/_legacy.py:3157 — agent/cli/_legacy.py:3157-3182 | agent/cli/_legacy.py:3186-3199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) agent/src/tools/research_reports_tool.py:112 — agent/src/tools/research_reports_tool.py:112-137 | agent/src/tools/shareholder_count_tool.py:84-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) agent/src/quantlib/valuation/dcf.py:255 — agent/src/quantlib/valuation/dcf.py:255-279 | agent/src/quantlib/valuation/threestatement.py:451-474 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) agent/src/strategy_discovery/evidence_store.py:244 — agent/src/strategy_discovery/evidence_store.py:244-268 | agent/src/strategy_discovery/evidence_store.py:298-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (19–23 lines × 3) · ×1
  • Duplicated block (19–23 lines × 3) agent/src/quantlib/valuation/artifact.py:736 — agent/src/quantlib/valuation/artifact.py:736-758 | agent/src/quantlib/valuation/artifact.py:809-827 | agent/src/quantlib/valuation/artifact.py:888-910 — 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 `agent/src/quantlib/valuation/artifact.py:736` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–21 lines × 6) · ×1
  • Duplicated block (16–21 lines × 6) agent/src/channels/config_meta.py:78 — agent/src/channels/config_meta.py:78-93 | agent/src/channels/config_meta.py:113-128 | agent/src/channels/config_meta.py:137-152 | agent/src/channels/config_meta.py:193-208 | agent/src/channels/config_meta.py:232-247 | agent/src/channels/config_meta.py:289-309 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/channels/config_meta.py:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) agent/backtest/loaders/akshare_loader.py:175 — agent/backtest/loaders/akshare_loader.py:175-194 | agent/backtest/loaders/eastmoney_loader.py:129-149 | REDACTED:126-146 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/akshare_loader.py:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×1
  • Duplicated block (19–21 lines × 2) agent/src/trading/connectors/futu/sdk.py:316 — agent/src/trading/connectors/futu/sdk.py:316-334 | agent/src/trading/connectors/futu/sdk.py:345-365 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/trading/connectors/futu/sdk.py:316` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×1
  • Duplicated block (18–20 lines × 2) agent/src/tools/autopilot_tool.py:597 — agent/src/tools/autopilot_tool.py:597-616 | agent/src/tools/backtest_tool.py:203-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) agent/src/trading/connectors/longbridge/sdk.py:552 — agent/src/trading/connectors/longbridge/sdk.py:552-571 | agent/src/trading/connectors/tiger/sdk.py:398-417 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) agent/src/factors/zoo/gtja191/alpha_149.py:54 — agent/src/factors/zoo/gtja191/alpha_149.py:54-72 | agent/src/factors/zoo/gtja191/alpha_181.py:54-72 | agent/src/factors/zoo/gtja191/alpha_182.py:54-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×1
  • Duplicated block (18–19 lines × 2) REDACTED:1014 — REDACTED:1014-1032 | REDACTED:1042-1059 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–19 lines × 2) · ×1
  • Duplicated block (9–19 lines × 2) agent/src/factors/bench_runner.py:350 — agent/src/factors/bench_runner.py:350-368 | agent/src/factors/bench_runner_strict.py:588-596 — 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 `agent/src/factors/bench_runner_strict.py:588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) agent/src/tools/trade_journal_parsers.py:387 — agent/src/tools/trade_journal_parsers.py:387-405 | agent/src/tools/trade_journal_parsers.py:675-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–18 lines × 2) · ×1
  • Duplicated block (10–18 lines × 2) agent/src/tools/block_trades_tool.py:154 — agent/src/tools/block_trades_tool.py:154-171 | agent/src/tools/symbol_search_tool.py:712-721 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–17 lines × 6) · ×1
  • Duplicated block (13–17 lines × 6) agent/src/trading/connectors/binance/sdk.py:227 — agent/src/trading/connectors/binance/sdk.py:227-242 | agent/src/trading/connectors/dhan/sdk.py:200-215 | agent/src/trading/connectors/mt5/reads.py:69-81 | agent/src/trading/connectors/shoonya/sdk.py:199-215 | agent/src/trading/connectors/tiger/sdk.py:195-208 | agent/src/trading/connectors/upbit/sdk.py:194-209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `BinanceConfig | None = None` in one and `DhanConfig | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) agent/src/swarm/worker.py:778 — agent/src/swarm/worker.py:778-794 | agent/src/swarm/worker.py:800-816 | agent/src/swarm/worker.py:853-869 | agent/src/swarm/worker.py:985-1001 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–17 lines × 2) · ×1
  • Duplicated block (12–17 lines × 2) agent/src/channels/telegram.py:167 — agent/src/channels/telegram.py:167-178 | agent/src/channels/telegram.py:282-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/channels/telegram.py:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) agent/src/factors/cli_handlers.py:1074 — agent/src/factors/cli_handlers.py:1074-1086 | agent/src/hypotheses/cli_handlers.py:266-282 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 `agent/src/factors/cli_handlers.py:1074` it begins part-way through the construct above it, so those 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–17 lines × 2) · ×1
  • Duplicated block (10–17 lines × 2) agent/src/providers/chat.py:360 — agent/src/providers/chat.py:360-376 | agent/src/providers/chat.py:382-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) agent/src/tools/web_search_tool.py:69 — agent/src/tools/web_search_tool.py:69-84 | agent/src/tools/web_search_tool.py:104-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–16 lines × 10) · ×1
  • Duplicated block (9–16 lines × 10) agent/src/trading/connectors/alpaca/sdk.py:175 — agent/src/trading/connectors/alpaca/sdk.py:175-183 | agent/src/trading/connectors/binance/sdk.py:198-206 | agent/src/trading/connectors/etoro/client.py:169-177 | agent/src/trading/connectors/futu/sdk.py:215-223 | agent/src/trading/connectors/ibkr/local.py:161-176 | REDACTED:164-172 | agent/src/trading/connectors/okx/sdk.py:168-176 | agent/src/trading/connectors/tiger/sdk.py:168-176 | agent/src/trading/connectors/toss/sdk.py:168-176 | agent/src/trading/connectors/trading212/sdk.py:151-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 10 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `AlpacaConfig` in one and `BinanceConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) agent/backtest/loaders/pykrx_loader.py:122 — agent/backtest/loaders/pykrx_loader.py:122-137 | agent/backtest/loaders/stooq_loader.py:209-224 | REDACTED:93-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/pykrx_loader.py:122` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) agent/src/api/live_routes.py:1384 — agent/src/api/live_routes.py:1384-1399 | agent/src/api/live_routes.py:1434-1448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) agent/backtest/loaders/akshare_loader.py:160 — agent/backtest/loaders/akshare_loader.py:160-173 | agent/backtest/loaders/eastmoney_loader.py:112-126 | REDACTED:110-123 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/akshare_loader.py: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.
D4 · Code Duplication · Duplicated block (8–15 lines × 3) · ×1
  • Duplicated block (8–15 lines × 3) agent/backtest/loaders/yahoo_client.py:220 — agent/backtest/loaders/yahoo_client.py:220-234 | agent/backtest/loaders/yahoo_client.py:348-355 | agent/backtest/loaders/yahoo_client.py:410-417 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) agent/src/config/writer.py:130 — agent/src/config/writer.py:130-144 | agent/src/tools/background_store.py:160-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 `agent/src/config/writer.py:130` it begins part-way through the construct above it, so those 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–14 lines × 6) · ×1
  • Duplicated block (10–14 lines × 6) agent/mcp_server.py:923 — agent/mcp_server.py:923-936 | agent/src/trading/connectors/binance/sdk.py:126-137 | agent/src/trading/connectors/futu/sdk.py:146-157 | agent/src/trading/connectors/kis/sdk.py:165-174 | agent/src/trading/connectors/okx/sdk.py:107-118 | agent/src/trading/connectors/toss/sdk.py:116-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times.
D4 · Code Duplication · Duplicated block (12–14 lines × 4) · ×1
  • Duplicated block (12–14 lines × 4) agent/backtest/loaders/alphavantage_loader.py:155 — agent/backtest/loaders/alphavantage_loader.py:155-168 | agent/backtest/loaders/finnhub_loader.py:220-233 | agent/backtest/loaders/mootdx_loader.py:150-161 | agent/backtest/loaders/yahoo_loader.py:244-257 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/alphavantage_loader.py:155` it begins part-way through the construct above it, so those 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 × 4) · ×1
  • Duplicated block (14 lines × 4) agent/backtest/loaders/fmp_loader.py:135 — agent/backtest/loaders/fmp_loader.py:135-148 | agent/backtest/loaders/pykrx_loader.py:131-144 | agent/backtest/loaders/sina_loader.py:168-181 | agent/backtest/loaders/stooq_loader.py:218-231 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) REDACTED:1053 — REDACTED:1053-1066 | REDACTED:1083-1093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1053` it begins part-way through the construct above it, so those 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–13 lines × 12) · ×1
  • Duplicated block (10–13 lines × 12) agent/backtest/loaders/akshare_loader.py:149 — agent/backtest/loaders/akshare_loader.py:149-158 | agent/backtest/loaders/alphavantage_loader.py:150-160 | agent/backtest/loaders/eastmoney_loader.py:100-110 | agent/backtest/loaders/finnhub_loader.py:215-225 | agent/backtest/loaders/fmp_loader.py:132-141 | agent/backtest/loaders/pykrx_loader.py:128-137 | agent/backtest/loaders/qveris_loader.py:370-382 | agent/backtest/loaders/sina_loader.py:165-174 | agent/backtest/loaders/stooq_loader.py:215-224 | REDACTED:99-108 | agent/backtest/loaders/tiingo_loader.py:326-336 | agent/backtest/loaders/yahoo_loader.py:239-249 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/akshare_loader.py:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/backtest/loaders/qveris_loader.py:368` calls `QVerisClient` and `agent/backtest/loaders/alphavantage_loader.py:148` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) REDACTED:445 — REDACTED:445-457 | REDACTED:474-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 5) · ×1
  • Duplicated block (10–12 lines × 5) agent/backtest/loaders/alphavantage_loader.py:154 — agent/backtest/loaders/alphavantage_loader.py:154-165 | agent/backtest/loaders/finnhub_loader.py:219-230 | agent/backtest/loaders/mootdx_loader.py:149-158 | agent/backtest/loaders/tiingo_loader.py:330-341 | agent/backtest/loaders/yahoo_loader.py:243-254 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/alphavantage_loader.py:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) agent/src/trading/connectors/binance/sdk.py:235 — agent/src/trading/connectors/binance/sdk.py:235-246 | agent/src/trading/connectors/dhan/sdk.py:208-219 | agent/src/trading/connectors/okx/sdk.py:209-220 | agent/src/trading/connectors/tiger/sdk.py:201-212 | agent/src/trading/connectors/upbit/sdk.py:202-213 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) agent/src/channels/whatsapp.py:223 — agent/src/channels/whatsapp.py:223-232 | agent/src/channels/whatsapp.py:253-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/channels/whatsapp.py:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) agent/src/quantlib/crossvalidation.py:258 — agent/src/quantlib/crossvalidation.py:258-269 | agent/src/quantlib/crossvalidation.py:527-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/crossvalidation.py:527` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 10) · ×1
  • Duplicated block (11 lines × 10) agent/src/factors/zoo/alpha101/alpha_007.py:60 — agent/src/factors/zoo/alpha101/alpha_007.py:60-70 | agent/src/factors/zoo/alpha101/alpha_009.py:55-65 | agent/src/factors/zoo/alpha101/alpha_010.py:55-65 | agent/src/factors/zoo/alpha101/alpha_021.py:65-75 | agent/src/factors/zoo/alpha101/alpha_023.py:60-70 | agent/src/factors/zoo/alpha101/alpha_024.py:67-77 | agent/src/factors/zoo/alpha101/alpha_027.py:65-75 | agent/src/factors/zoo/alpha101/alpha_046.py:67-77 | agent/src/factors/zoo/alpha101/alpha_049.py:67-77 | agent/src/factors/zoo/alpha101/alpha_051.py:67-77 — before extracting anything, compare `agent/src/factors/zoo/alpha101/alpha_049.py` and `agent/src/factors/zoo/alpha101/alpha_051.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/factors/zoo/alpha101/alpha_007.py:54` calls `_make_one`, `DataFrame` and `agent/src/factors/zoo/alpha101/alpha_009.py:51` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) agent/src/trading/connectors/dhan/sdk.py:171 — agent/src/trading/connectors/dhan/sdk.py:171-181 | agent/src/trading/connectors/kis/sdk.py:229-239 | agent/src/trading/connectors/shoonya/sdk.py:171-181 | agent/src/trading/connectors/upbit/sdk.py:165-175 | agent/src/trading/connectors/zerodha/sdk.py:165-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `DhanConfig` in one and `KISConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (10 lines × 7) · ×1
  • Duplicated block (10 lines × 7) agent/backtest/loaders/akshare_loader.py:151 — agent/backtest/loaders/akshare_loader.py:151-160 | agent/backtest/loaders/alphavantage_loader.py:152-163 | agent/backtest/loaders/eastmoney_loader.py:102-113 | agent/backtest/loaders/finnhub_loader.py:217-228 | agent/backtest/loaders/mootdx_loader.py:147-156 | agent/backtest/loaders/tiingo_loader.py:328-339 | agent/backtest/loaders/yahoo_loader.py:241-252 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) agent/src/trading/service.py:503 — agent/src/trading/service.py:503-512 | agent/src/trading/service.py:524-535 | agent/src/trading/service.py:543-552 | agent/src/trading/service.py:565-576 | agent/src/trading/service.py:589-600 | agent/src/trading/service.py:614-625 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/trading/service.py:503` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) agent/src/trading/connectors/longbridge/sdk.py:536 — agent/src/trading/connectors/longbridge/sdk.py:536-545 | agent/src/trading/connectors/longbridge/sdk.py:553-561 | agent/src/trading/connectors/tiger/sdk.py:383-392 | agent/src/trading/connectors/tiger/sdk.py:399-407 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) agent/src/factors/zoo/alpha101/alpha_046.py:88 — agent/src/factors/zoo/alpha101/alpha_046.py:88-97 | agent/src/factors/zoo/alpha101/alpha_049.py:88-97 | agent/src/factors/zoo/alpha101/alpha_051.py:88-97 — before extracting anything, compare `agent/src/factors/zoo/alpha101/alpha_049.py` and `agent/src/factors/zoo/alpha101/alpha_051.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×1
  • Duplicated block (8–9 lines × 4) agent/cli/commands/goal.py:155 — agent/cli/commands/goal.py:155-163 | agent/cli/commands/goal.py:225-232 | agent/cli/commands/goal.py:266-274 | agent/cli/commands/goal.py:298-306 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) agent/src/quantlib/crossvalidation.py:268 — agent/src/quantlib/crossvalidation.py:268-274 | agent/src/quantlib/crossvalidation.py:365-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/quantlib/crossvalidation.py:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) agent/src/trading/connectors/alpaca/sdk.py:504 — agent/src/trading/connectors/alpaca/sdk.py:504-510 | agent/src/trading/connectors/binance/sdk.py:577-583 | agent/src/trading/connectors/kis/sdk.py:506-512 | agent/src/trading/connectors/upbit/sdk.py:419-425 — 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. The matched lines also transfer control out of the body holding them, 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 (2–7 lines × 5) · ×1
  • Duplicated block (2–7 lines × 5) agent/src/factors/zoo/alpha101/alpha_071.py:67 — agent/src/factors/zoo/alpha101/alpha_071.py:67-73 | agent/src/factors/zoo/alpha101/alpha_073.py:67-73 | agent/src/factors/zoo/alpha101/alpha_076.py:102-103 | agent/src/factors/zoo/alpha101/alpha_087.py:102-103 | agent/src/factors/zoo/alpha101/alpha_096.py:65-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) agent/backtest/engines/base.py:1135 — agent/backtest/engines/base.py:1135-1139 | agent/backtest/engines/base.py:1190-1195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/engines/base.py:1135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) agent/src/skills/candlestick/example_signal_engine.py:559 — agent/src/skills/candlestick/example_signal_engine.py:559-563 | agent/src/skills/elliott-wave/example_signal_engine.py:440-444 | agent/src/skills/harmonic/example_signal_engine.py:457-461 | agent/src/skills/ichimoku/example_signal_engine.py:161-165 | agent/src/skills/smc/example_signal_engine.py:49-53 | agent/src/skills/technical-basic/example_signal_engine.py:273-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) agent/src/tools/get_fundamentals_tool.py:136 — agent/src/tools/get_fundamentals_tool.py:136-140 | agent/src/tools/get_fundamentals_tool.py:143-147 | agent/src/tools/market_data_tool.py:170-174 | agent/src/tools/research_papers_tool.py:1584-1588 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, 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 (4–13 lines × 12) · ×1
  • Duplicated block (4–13 lines × 12) agent/src/factors/zoo/academic/bab.py:53 — agent/src/factors/zoo/academic/bab.py:53-56 | agent/src/factors/zoo/academic/carhart_mom.py:48-51 | agent/src/factors/zoo/academic/cma.py:48-51 | agent/src/factors/zoo/academic/corr_rewire.py:151-154 | agent/src/factors/zoo/academic/high52w.py:47-50 | agent/src/factors/zoo/academic/hml.py:48-66 | agent/src/factors/zoo/academic/illiq.py:47-50 | agent/src/factors/zoo/academic/mkt_rf.py:45-48 | agent/src/factors/zoo/academic/retskew.py:47-50 | agent/src/factors/zoo/academic/rmw.py:47-50 | agent/src/factors/zoo/academic/smb.py:46-49 | agent/src/factors/zoo/academic/strev.py:46-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 12 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) agent/src/tools/lockup_expiry_tool.py:132 — agent/src/tools/lockup_expiry_tool.py:132-160 | agent/src/tools/sector_tool.py:88-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×1
  • Duplicated block (5 lines × 8) agent/src/trading/connectors/alpaca/sdk.py:888 — agent/src/trading/connectors/alpaca/sdk.py:888-892 | agent/src/trading/connectors/binance/shaping.py:31-35 | agent/src/trading/connectors/ibkr/local.py:692-696 | agent/src/trading/connectors/longbridge/sdk.py:801-805 | agent/src/trading/connectors/okx/sdk.py:659-663 | agent/src/trading/connectors/tiger/sdk.py:644-648 | agent/src/trading/connectors/toss/sdk.py:621-625 | agent/src/trading/connectors/trading212/sdk.py:520-524 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 8 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.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) agent/src/factors/zoo/qlib158/cntd10.py:27 — agent/src/factors/zoo/qlib158/cntd10.py:27-34 | agent/src/factors/zoo/qlib158/cntd20.py:27-34 | agent/src/factors/zoo/qlib158/cntd30.py:27-34 | agent/src/factors/zoo/qlib158/cntd5.py:27-34 | agent/src/factors/zoo/qlib158/cntd60.py:27-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
R10 · Code Duplication · Duplication concentrated across 3 sibling directories (24 clone groups) · ×1
  • Duplication concentrated across 3 sibling directories (24 clone groups) frontend/src/components/charts/RegimeTimeline.tsx:121 — 24 duplicated blocks under frontend/src/ have copies in at least two of the sibling directories components, lib, pages — 10 of them are reported below, and 14 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 24 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 24 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 24 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplicated block with local edits (86 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (86 matched lines × 2 locations) desktop/electron/scripts/build-review-installer.mjs:34 — desktop/electron/scripts/build-review-installer.mjs:34 · desktop/electron/scripts/build-signed-installer.mjs:43 — the two spans are one implementation copied and then locally edited — 581 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (66 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (66 matched lines × 2 locations) frontend/src/lib/api.ts:554 — frontend/src/lib/api.ts:554 · frontend/src/lib/api.ts:723 — the two spans are one implementation copied and then locally edited — 501 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (34 lines × 2 locations) · ×1
  • Duplicated block (34 lines × 2 locations) frontend/src/pages/Settings.tsx:642 — frontend/src/pages/Settings.tsx:642 · frontend/src/pages/Settings.tsx:677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (27 lines × 2 locations) · ×1
  • Duplicated block (27 lines × 2 locations) frontend/src/pages/AlphaZoo.tsx:717 — frontend/src/pages/AlphaZoo.tsx:717 · frontend/src/pages/AlphaZoo.tsx:1097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) frontend/src/components/chat/Composer.tsx:350 — frontend/src/components/chat/Composer.tsx:350 · frontend/src/components/chat/Composer.tsx:370 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×1
  • Duplicated block (16 lines × 2 locations) desktop/electron/scripts/process-sentinel.mjs:34 — desktop/electron/scripts/process-sentinel.mjs:34 · desktop/electron/src/backend-manager.ts:521 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block with local edits (14 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (14 matched lines × 2 locations) frontend/src/components/charts/EquityChart.tsx:32 — frontend/src/components/charts/EquityChart.tsx:32 · frontend/src/components/charts/WalkForwardChart.tsx:31 — the two spans are one implementation copied and then locally edited — 87 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 3 locations) · ×1
  • Duplicated block (13 lines × 3 locations) frontend/src/pages/AlphaZoo.tsx:272 — frontend/src/pages/AlphaZoo.tsx:272 · frontend/src/pages/AlphaZoo.tsx:288 · frontend/src/pages/AlphaZoo.tsx:306 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication · Duplicated block with local edits (12 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (12 matched lines × 2 locations) frontend/src/components/layout/Layout.tsx:114 — frontend/src/components/layout/Layout.tsx:114 · frontend/src/components/layout/Layout.tsx:128 — the two spans are one implementation copied and then locally edited — 92 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 45, cognitive 72) · ×1
  • Complex function (anonymous) (cyclomatic 45, cognitive 72) frontend/src/pages/Agent.tsx:546 — (anonymous) has cyclomatic complexity 45 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function OptionsLab (cyclomatic 44, cognitive 39) · ×1
  • Complex function OptionsLab (cyclomatic 44, cognitive 39) frontend/src/pages/OptionsLab.tsx:58 — OptionsLab has cyclomatic complexity 44 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Settings (cyclomatic 43, cognitive 39) · ×1
  • Complex function Settings (cyclomatic 43, cognitive 39) frontend/src/pages/Settings.tsx:41 — Settings has cyclomatic complexity 43 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function RunDetail (cyclomatic 41, cognitive 30) · ×1
  • Complex function RunDetail (cyclomatic 41, cognitive 30) frontend/src/pages/RunDetail.tsx:124 — RunDetail has cyclomatic complexity 41 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function attempt.completed (cyclomatic 39, cognitive 42) · ×1
  • Complex function attempt.completed (cyclomatic 39, cognitive 42) frontend/src/pages/Agent.tsx:952 — attempt.completed has cyclomatic complexity 39 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Scheduled (cyclomatic 38, cognitive 33) · ×1
  • Complex function Scheduled (cyclomatic 38, cognitive 33) frontend/src/pages/Scheduled.tsx:92 — Scheduled has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function BrokerRow (cyclomatic 37, cognitive 34) · ×1
  • Complex function BrokerRow (cyclomatic 37, cognitive 34) frontend/src/components/chat/RunnerStatus.tsx:121 — BrokerRow has cyclomatic complexity 37 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ChannelConfigPanel (cyclomatic 35, cognitive 32) · ×1
  • Complex function ChannelConfigPanel (cyclomatic 35, cognitive 32) frontend/src/components/settings/ChannelConfigPanel.tsx:193 — ChannelConfigPanel has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ConnectionCard (cyclomatic 34, cognitive 29) · ×1
  • Complex function ConnectionCard (cyclomatic 34, cognitive 29) frontend/src/components/portfolio/ConnectionCenter.tsx:169 — ConnectionCard has cyclomatic complexity 34 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function renderField (cyclomatic 31, cognitive 37) · ×1
  • Complex function renderField (cyclomatic 31, cognitive 37) frontend/src/components/settings/ChannelConfigPanel.tsx:534 — renderField has cyclomatic complexity 31 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Portfolio (cyclomatic 30, cognitive 28) · ×1
  • Complex function Portfolio (cyclomatic 30, cognitive 28) frontend/src/pages/Portfolio.tsx:135 — Portfolio has cyclomatic complexity 30 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function MandateProposalCard (cyclomatic 26, cognitive 26) · ×1
  • Complex function MandateProposalCard (cyclomatic 26, cognitive 26) frontend/src/components/chat/MandateProposalCard.tsx:203 — MandateProposalCard has cyclomatic complexity 26 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function applySwarmEvent (cyclomatic 26, cognitive 26) · ×1
  • Complex function applySwarmEvent (cyclomatic 26, cognitive 26) frontend/src/lib/swarmStatus.ts:209 — applySwarmEvent has cyclomatic complexity 26 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Agent (cyclomatic 26, cognitive 23) · ×1
  • Complex function Agent (cyclomatic 26, cognitive 23) frontend/src/pages/Agent.tsx:233 — Agent has cyclomatic complexity 26 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ToolRow (cyclomatic 25, cognitive 25) · ×1
  • Complex function ToolRow (cyclomatic 25, cognitive 25) frontend/src/components/chat/ToolProgressIndicator.tsx:128 — ToolRow has cyclomatic complexity 25 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Layout (cyclomatic 25, cognitive 23) · ×1
  • Complex function Layout (cyclomatic 25, cognitive 23) frontend/src/components/layout/Layout.tsx:21 — Layout has cyclomatic complexity 25 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function buildPayoffRequest (cyclomatic 24, cognitive 26) · ×1
  • Complex function buildPayoffRequest (cyclomatic 24, cognitive 26) frontend/src/lib/options.ts:181 — buildPayoffRequest has cyclomatic complexity 24 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 23, cognitive 31) · ×1
  • Complex function (anonymous) (cyclomatic 23, cognitive 31) frontend/src/pages/Agent.tsx:1438 — (anonymous) has cyclomatic complexity 23 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CustomProviderManager (cyclomatic 23, cognitive 16) · ×1
  • Complex function CustomProviderManager (cyclomatic 23, cognitive 16) frontend/src/components/settings/CustomProviderManager.tsx:20 — CustomProviderManager has cyclomatic complexity 23 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function compareSemanticVersions (cyclomatic 21, cognitive 36) · ×1
  • Complex function compareSemanticVersions (cyclomatic 21, cognitive 36) desktop/electron/src/update-verification.ts:229 — compareSemanticVersions has cyclomatic complexity 21 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · frontend/src/lib/api.ts · ×1
  • frontend/src/lib/api.ts: 2070 lines of code frontend/src/lib/api.ts:1 — frontend/src/lib/api.ts has 2070 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Agent.tsx · ×1
  • frontend/src/pages/Agent.tsx: 1910 lines of code frontend/src/pages/Agent.tsx:1 — frontend/src/pages/Agent.tsx has 1910 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/AlphaZoo.tsx · ×1
  • frontend/src/pages/AlphaZoo.tsx: 1212 lines of code frontend/src/pages/AlphaZoo.tsx:1 — frontend/src/pages/AlphaZoo.tsx has 1212 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/RunDetail.tsx · ×1
  • frontend/src/pages/RunDetail.tsx: 1141 lines of code frontend/src/pages/RunDetail.tsx:1 — frontend/src/pages/RunDetail.tsx has 1141 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/settings/ChannelConfigPanel.tsx · ×1
  • frontend/src/components/settings/ChannelConfigPanel.tsx: 820 lines of code frontend/src/components/settings/ChannelConfigPanel.tsx:1 — frontend/src/components/settings/ChannelConfigPanel.tsx has 820 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Scheduled.tsx · ×1
  • frontend/src/pages/Scheduled.tsx: 818 lines of code frontend/src/pages/Scheduled.tsx:1 — frontend/src/pages/Scheduled.tsx has 818 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Settings.tsx · ×1
  • frontend/src/pages/Settings.tsx: 702 lines of code frontend/src/pages/Settings.tsx:1 — frontend/src/pages/Settings.tsx has 702 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Portfolio.tsx · ×1
  • frontend/src/pages/Portfolio.tsx: 659 lines of code frontend/src/pages/Portfolio.tsx:1 — frontend/src/pages/Portfolio.tsx has 659 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Runtime.tsx · ×1
  • frontend/src/pages/Runtime.tsx: 607 lines of code frontend/src/pages/Runtime.tsx:1 — frontend/src/pages/Runtime.tsx has 607 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/PaperTrading.tsx · ×1
  • frontend/src/pages/PaperTrading.tsx: 569 lines of code frontend/src/pages/PaperTrading.tsx:1 — frontend/src/pages/PaperTrading.tsx has 569 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/run/PositionsTab.tsx · ×1
  • frontend/src/components/run/PositionsTab.tsx: 564 lines of code frontend/src/components/run/PositionsTab.tsx:1 — frontend/src/components/run/PositionsTab.tsx has 564 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/electron/src/backend-manager.ts · ×1
  • desktop/electron/src/backend-manager.ts: 495 lines of code desktop/electron/src/backend-manager.ts:1 — desktop/electron/src/backend-manager.ts has 495 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/layout/Layout.tsx · ×1
  • frontend/src/components/layout/Layout.tsx: 493 lines of code frontend/src/components/layout/Layout.tsx:1 — frontend/src/components/layout/Layout.tsx has 493 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/chat/Composer.tsx · ×1
  • frontend/src/components/chat/Composer.tsx: 486 lines of code frontend/src/components/chat/Composer.tsx:1 — frontend/src/components/chat/Composer.tsx has 486 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/lib/swarmStatus.ts · ×1
  • frontend/src/lib/swarmStatus.ts: 483 lines of code frontend/src/lib/swarmStatus.ts:1 — frontend/src/lib/swarmStatus.ts has 483 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/pages/Compare.tsx · ×1
  • frontend/src/pages/Compare.tsx: 447 lines of code frontend/src/pages/Compare.tsx:1 — frontend/src/pages/Compare.tsx has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/chat/MandateProposalCard.tsx · ×1
  • frontend/src/components/chat/MandateProposalCard.tsx: 435 lines of code frontend/src/components/chat/MandateProposalCard.tsx:1 — frontend/src/components/chat/MandateProposalCard.tsx has 435 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · frontend/src/components/chat/WelcomeScreen.tsx · ×1
  • frontend/src/components/chat/WelcomeScreen.tsx: 402 lines of code frontend/src/components/chat/WelcomeScreen.tsx:1 — frontend/src/components/chat/WelcomeScreen.tsx has 402 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling · No lint script · ×1
  • No lint script — test ✓ · lint ✗ · typecheck ✓ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
R7 · Dead Code · Dead file (~169 LoC) · ×1
  • Dead file (~169 LoC) desktop/electron/src/backend-watchdog.ts — no import path from any entry point (21 application, 13 tooling, 99 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~87 LoC) · ×1
  • Dead file (~87 LoC) wiki/functions/api/stats.js — no import path from any entry point (21 application, 13 tooling, 99 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~73 LoC) · ×1
  • Dead file (~73 LoC) wiki/functions/_middleware.js — no import path from any entry point (21 application, 13 tooling, 99 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~17 LoC) · ×1
  • Dead file (~17 LoC) desktop/electron/src/preload.ts — no import path from any entry point (21 application, 13 tooling, 99 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unused dependency '@fontsource/inter' · ×1
  • Unused dependency '@fontsource/inter' — Declared in frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency '@fontsource/jetbrains-mono' · ×1
  • Unused dependency '@fontsource/jetbrains-mono' — Declared in frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×1
  • Untrusted text written into markup unescaped wiki/site.js:71 — `messages?.[html]??original` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×1
  • Swallowed exception (caught, then discarded) agent/src/ui_services.py:61 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Minor — 125 finding(s)
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×26
  • Silent fallback default on parse failure agent/backtest/loaders/mt5_loader.py:72 — `_read_mt5_config` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/backtest/loaders/qveris_loader.py:530 — `_success_rate` returns `0.0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure REDACTED:487 — `_parse_items` returns `[]` when `(ParseError, DefusedXmlException)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/cli/_legacy.py:330 — `_read_json` returns `{}` when `(json.JSONDecodeError, OSError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/cli/_legacy.py:549 — `_metric_value_style` returns `'white'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/cli/ui/rail.py:65 — `_coerce_int` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/cli/utils/format.py:91 — `format_tokens` returns `'0 tokens'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/cli/utils/format.py:136 — `abbreviate_num` returns `'—'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/grounding/evidence.py:1161 — `_record_metrics_file` returns `0` when `(OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/grounding/evidence.py:294 — `_run_card_manifest` returns `{}` when `(OSError, UnicodeDecodeError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/grounding/evidence.py:315 — `_summary_scalars` returns `[]` when `(OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/llm_usage.py:31 — `_coerce_usage_int` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/resolution_context.py:186 — `_source_rank` returns `-1` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/tool_results.py:34 — `_failure_code` returns `''` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/agent/tool_results.py:169 — `_previously_archived` returns `set()` when `(OSError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/api/runs_routes.py:410 — `_pearson_correlation` returns `0.0` when `(statistics.StatisticsError, ValueError, OverflowError, ZeroDivisionError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/config/schema.py:68 — `_url_host` returns `''` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/factors/compare_runner.py:40 — `_sort_value` returns `0.0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/live/daily_count.py:115 — `read_daily_count` returns `0` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/live/runtime/reconcile.py:270 — `_position_qty` returns `0.0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/providers/capabilities.py:367 — `_provider_default_base_urls` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/providers/llm.py:849 — `_redact_base_url_for_log` returns `'<base-url>'` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/providers/openai_codex.py:178 — `_decode_jwt_claims` returns `{}` when `(IndexError, UnicodeError, ValueError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/providers/openai_codex.py:192 — `_token_expiry_ms` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure agent/src/session/search.py:470 — `_format_time` returns `'unknown'` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • + 1 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate frontend/src/components/charts/AnnualReturnsChart.tsx:30 — `!Array.isArray(params) || !params.length` appears character-identically in 9 files — frontend/src/components/charts/AnnualReturnsChart.tsx, frontend/src/components/charts/AttributionCumulativeChart.tsx, frontend/src/components/charts/AttributionWaterfallChart.tsx, frontend/src/components/charts/CandlestickChart.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/electron/scripts/build-review-installer.mjs:41 — `entry.isFile() && /^Vibe-Trading-Desktop-Unofficial-.*-x64\.exe$/u.test(entry.name)` appears character-identically in 2 files — desktop/electron/scripts/build-review-installer.mjs, desktop/electron/scripts/build-signed-installer.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/electron/scripts/build-review-installer.mjs:47 — `entry.isFile() && entry.name.toLowerCase().endsWith(".exe")` appears character-identically in 2 files — desktop/electron/scripts/build-review-installer.mjs, desktop/electron/scripts/build-signed-installer.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/hooks/useAlphaJob.ts:59 — `error instanceof ApiError && error.status === 404` appears character-identically in 2 files — frontend/src/hooks/useAlphaJob.ts, frontend/src/pages/Agent.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/components/chat/GoalPanel.tsx:16 — `isCriterionStatusMet(criterion.status) || criterionEvidenceCount(snapshot, criterion.criterion_id) > 0` appears character-identically in 2 files — frontend/src/components/chat/GoalPanel.tsx, frontend/src/pages/Agent.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/pages/Runtime.tsx:522 — `tone === "danger" && "bg-danger/10 text-danger"` appears character-identically in 2 files — frontend/src/pages/Runtime.tsx, frontend/src/pages/Scheduled.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/pages/Runtime.tsx:524 — `tone === "neutral" && "bg-muted text-muted-foreground"` appears character-identically in 2 files — frontend/src/pages/Runtime.tsx, frontend/src/pages/Scheduled.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/pages/Runtime.tsx:521 — `tone === "success" && "bg-success/10 text-success"` appears character-identically in 2 files — frontend/src/pages/Runtime.tsx, frontend/src/pages/Scheduled.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate frontend/src/pages/Runtime.tsx:523 — `tone === "warning" && "bg-warning/10 text-warning"` appears character-identically in 2 files — frontend/src/pages/Runtime.tsx, frontend/src/pages/Scheduled.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/tools/paper_trade/data.py:159 — `"vol" in df.columns and "volume" not in df.columns` appears character-identically in 2 files — agent/src/tools/paper_trade/data.py, agent/src/tools/paper_trade/data_5m.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/backtest/loaders/ccxt_loader.py:101 — `_first_proxy_env("HTTPS_PROXY", "https_proxy") or all_proxy or http_proxy` appears character-identically in 2 files — agent/backtest/loaders/ccxt_loader.py, agent/backtest/loaders/okx.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/backtest/loaders/ccxt_loader.py:100 — `_first_proxy_env("HTTP_PROXY", "http_proxy") or all_proxy` appears character-identically in 2 files — agent/backtest/loaders/ccxt_loader.py, agent/backtest/loaders/okx.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/api/alpha_routes.py:389 — `_sys.modules.get("api_server") or _sys.modules.get("agent.api_server")` appears character-identically in 17 files — agent/src/api/alpha_routes.py, agent/src/api/attribution_routes.py, agent/src/api/auth_routes.py, agent/src/api/channels_config_routes.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/trading/connectors/dhan/sdk.py:490 — `amount.is_finite() and amount >= 1 and amount == amount.to_integral_value()` appears character-identically in 3 files — agent/src/trading/connectors/dhan/sdk.py, agent/src/trading/connectors/shoonya/sdk.py, agent/src/trading/connectors/zerodha/sdk.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/agent/grounding/evidence.py:866 — `arguments.get("run_dir") or payload.get("run_dir")` appears character-identically in 2 files — agent/src/agent/grounding/evidence.py, agent/src/agent/grounding/ledger.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:301 — `asyncio.current_task() and asyncio.current_task().cancelling()` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/backtest/engines/korea_equity.py:218 — `bar.get("open", bar.get("close", 0.0)) or 0.0` appears character-identically in 2 files — agent/backtest/engines/korea_equity.py, agent/backtest/engines/vietnam_equity.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/backtest/engines/china_a.py:222 — `bar_date is not None and entry_date is not None and bar_date == entry_date` appears character-identically in 2 files — agent/backtest/engines/china_a.py, agent/backtest/engines/india_equity.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/live/order_guard.py:567 — `breach.detail or f"order breaches {breach.limit}"` appears character-identically in 2 files — agent/src/live/order_guard.py, agent/src/live/sdk_order_gate.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/src/trading/connectors/etoro/trading.py:59 — `clean_type == "limit" and limit_price is None` appears character-identically in 2 files — agent/src/trading/connectors/etoro/trading.py, agent/src/trading/connectors/mt5/orders.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/backtest/engines/base.py:713 — `close_arr is not None and col is not None and row >= 0` appears character-identically in 3 files — agent/backtest/engines/base.py, agent/backtest/engines/korea_equity.py, agent/backtest/engines/vietnam_equity.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/cli/commands/chat.py:107 — `ctx is None or not hasattr(ctx, "pending_prompt")` appears character-identically in 2 files — agent/cli/commands/chat.py, agent/cli/commands/research_playbook.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/cli/_legacy.py:1015 — `data.get("tool") != _PROPOSAL_TOOL_NAME or data.get("status") != "ok"` appears character-identically in 2 files — agent/cli/_legacy.py, agent/src/api/sessions_routes.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/cli/_legacy.py:1025 — `data.get("tool") != _SCHEDULED_PROPOSAL_TOOL_NAME or data.get("status") != "ok"` appears character-identically in 2 files — agent/cli/_legacy.py, agent/src/api/sessions_routes.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate agent/cli/_legacy.py:4847 — `dataclasses.is_dataclass(value) and not isinstance(value, type)` appears character-identically in 3 files — agent/cli/_legacy.py, agent/src/quantlib/valuation/artifact.py, agent/src/tools/quantlib_tool.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×17
  • Hand-rolled JSON/XML parsing via regex frontend/src/pages/Agent.tsx:1053 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex frontend/src/lib/swarmStatus.ts:412 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex frontend/src/lib/swarmStatus.ts:414 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex frontend/src/lib/swarmStatus.ts:415 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex frontend/src/lib/swarmStatus.ts:421 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/tools/etf_holdings_tool.py:825 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/tools/etf_holdings_tool.py:836 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/tools/etf_holdings_tool.py:838 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/api/sessions_routes.py:255 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/api/sessions_routes.py:258 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/src/api/sessions_routes.py:329 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:918 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:919 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:927 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:932 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:960 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex agent/cli/_legacy.py:963 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
X7 · Silent fallback defaults · Silent fallback default in catch · ×13
  • Silent fallback default in catch agent/backtest/loaders/gildata_codes.py:69 — `_load_cache` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/_legacy.py:353 — `_read_metrics` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/_legacy.py:420 — `_terminal_width` swallows every exception into `return 80` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/main.py:183 — `_probe_session_count` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/main.py:391 — `_build_session_history` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/main.py:660 — `_summarise_tool_result` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/cli/main.py:1354 — `_interactive_loop` swallows every exception into `return 1` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/src/agent/context.py:384 — `_count_data_sources` swallows every exception into `return 18` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch REDACTED:68 — `_as_int` (in `_build_client_version`) swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/src/factors/compare_runner.py:53 — `_zoo_of` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/src/portfolio/oauth_worker.py:21 — `main` swallows every exception into `return 1` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/src/strategy_discovery/guard.py:70 — `routing_block` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch agent/src/tools/mcp.py:1429 — `_http_error_body` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D34 · Knowledge Freshness · Orphaned file · ×10
  • Orphaned file agent/backtest/engines/korea_equity.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/openbb_bridge/context_injector.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/backtest/loaders/pykrx_loader.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/openbb_bridge/routes.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/config/migrate.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/openbb_bridge/event_mapper.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/trading/connectors/mt5/symbols.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/trading/connectors/mt5/profiles.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/trading/connectors/shoonya/profiles.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file agent/src/trading/connectors/dhan/profiles.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D16 · Bus Factor · Off-boarding risk · ×5
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 22 significant file(s) lose their only recent owner: agent/src/tools/institutional_holdings_tool.py, agent/src/quantlib/performance.py, agent/src/skills/multi-factor/zoo_signal_engine.py, agent/cli/stream.py, agent/src/tools/propose_mandate_tool.py, agent/src/live/runtime/jobstore.py, agent/src/tools/pdf_report.py, frontend/src/components/chat/LiveRuntimePanel.tsx (+14 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 10 significant file(s) lose their only recent owner: agent/src/tools/ocr/llm_vision_ocr.py, agent/src/live/advisory/__init__.py, frontend/src/components/charts/OptionsPayoffChart.tsx, agent/src/config/writer.py, frontend/src/components/charts/AttributionCumulativeChart.tsx, frontend/src/components/charts/RollingBetaAlphaChart.tsx, agent/src/live/advisory/mock.py, frontend/src/components/run/RunCard.tsx (+2 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: agent/src/factors/zoo/academic/illiq.py, agent/src/factors/zoo/academic/retskew.py, agent/src/factors/zoo/academic/high52w.py, agent/src/factors/zoo/academic/strev.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 3 significant file(s) lose their only recent owner: agent/src/trading/connectors/etoro/instruments.py, agent/src/trading/connectors/etoro/sdk.py, agent/src/trading/connectors/etoro/profiles.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: agent/src/skills/harmonic/example_signal_engine.py, agent/src/skills/elliott-wave/example_signal_engine.py, agent/src/factors/zoo/gtja191/alpha_055.py. Pair on, review, or document these before any departure.
X4 · Structured logging · Interpolated log message defeats structured logging · ×5
  • Interpolated log message defeats structured logging REDACTED:608 — `info` at line 608 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:618 — `info` at line 618 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:1158 — `exception` at line 1158 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging agent/src/agent/tool_lifecycle.py:234 — `warning` at line 234 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging agent/src/agent/tool_lifecycle.py:532 — `info` at line 532 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
D24 · Comment Value · redundant comment · ×2
  • redundant comment frontend/src/lib/__tests__/formatters.test.ts:107 — "max_consecutive_loss" repeats the code it sits on: 3 of its 3 words (max, consecutive, loss) are already in `it("max_consecutive_loss: <= 3 positive, <= 6 neutral, > 6 negative", () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment frontend/src/lib/__tests__/tearsheet.test.ts:243 — "The recovered episode keeps its recovery time" repeats the code it sits on: 4 of its 5 words (recovered, episode, recovery, time) are already in `const recovered = episodes.find((e) => e.recoveryTime !== null);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
C2 · Access Controls · No named authorization policies · ×1
  • No named authorization policies — Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
D10 · Test Quality · Mock-dominated test · ×1
  • Mock-dominated test: downloads PDF bytes with bearer authentication and keeps the key out of the URL frontend/src/lib/__tests__/api.test.ts:11 — This test sets up 7 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 19 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (66 single-owned of 738 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 738 of the 1359 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (2 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)) (+13 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: agent/backtest/binance_account_reconciliation.py, agent/backtest/binance_shadow_evidence.py, desktop/electron/src/locales.ts, desktop/electron/src/main.ts, agent/src/portfolio/extraetf.py, agent/src/trading/connectors/upbit/sdk.py, agent/backtest/engines/vietnam_equity.py, agent/src/live/pending_action.py (+13 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — 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/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 2 of 4 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `agent` (248962 LoC, 2007 module-visible types across 103 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.
D30 · Dependency Vulnerabilities · Low CVE · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 10 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: agent/backtest/engines/korea_equity.py, agent/src/openbb_bridge/context_injector.py, agent/backtest/loaders/pykrx_loader.py, agent/src/openbb_bridge/routes.py, agent/src/openbb_bridge/event_mapper.py, agent/src/config/migrate.py, agent/src/trading/connectors/mt5/symbols.py, agent/src/trading/connectors/mt5/profiles.py (and 2 more) (11 orphaned of 738 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 738 of the 1359 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
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.
M2 · Architecture documentation · No architecture diagram/doc · ×1
  • No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `desktop/electron`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST .github/workflows/desktop-windows.yml:13 — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 29130 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.
S1 · Web-Security Posture · Security headers incomplete · ×1
  • Security headers incomplete wiki/_headers:1 — Set: Content-Security-Policy, Permissions-Policy, Referrer-Policy, X-Content-Type-Options, X-Frame-Options. Missing: Strict-Transport-Security — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−0.5 on this card.)
X2 · Cancellation propagation · Not all async functions that make a request accept an AbortSignal · ×1
  • Not all async functions that make a request accept an AbortSignal — Only 4/8 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~1.0 `!` null assertions per 1k TypeScript source lines — 32 assertion(s) across the 30551 source line(s) of the 127 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: frontend/src/components/chat/ToolProgressIndicator.tsx (8), frontend/src/lib/indicators.ts (7), frontend/src/components/charts/ValidationPanel.tsx (3). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
X7 · Silent fallback defaults · Pending state with no failure state · ×1
  • Pending state with no failure state frontend/src/components/chat/RunCompleteCard.tsx:118 — The view draws `<Loader2 class="h-3.5 w-3.5 animate-spin"/>` under `pineLoading`, but `pineLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Minor — 5 finding(s)
D12 · Dependency Hygiene · Outdated · ×5
  • Outdated: httpcore2 — `httpcore2` is pinned to 2.13.1, but 2.16.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.13.1 until the declaration is edited.
  • Outdated: importlib-metadata — `importlib-metadata` is pinned to 9.0.0, but 10.1.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 9.0.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: truststore — `truststore` is pinned to 0.10.4, but 0.10.5 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.10.4 until the declaration is edited.
  • Outdated: uvloop — `uvloop` is pinned to 0.22.1, but 0.23.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.22.1 until the declaration is edited.
  • Outdated: zipp — `zipp` is pinned to 4.1.0, but 4.1.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 4.1.0 until the declaration is edited.

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-a25aebb9b9194a28b047562ce3806e25/history.json --exit-code 0 --source .3artifacts/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-a25aebb9b9194a28b047562ce3806e25/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 .18artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update9artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .0artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep --config /opt/semgrep-rules/gdpr.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 .1artifacts/raw/semgrep-gdpr.json
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a1a3d3-2ee9-7fbc-8d66-8cb9e956a1a1 · 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