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

HKUDS/Vibe-Trading

Measured 16 November 2026, 04:22 UTC, at code version 1dbe5d5

CAI score 57out of 100 Weak
CriticalWeakAdequateStrongExemplary
Up 5 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: 292,812 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 3.7 person-years · Weakest lens: Production Readiness, 49

Findings by how serious they are

23 critical 2314 serious 149 minor

13 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
16 November 2026, 04:22 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 ▸

82of 82 dimensions measured by tools.
2464of 2486 findings point to an exact file and line, so you can open each one in the code. The other 22 concern the repository as a whole, such as missing documentation.
82dimensions across 7 lenses, read from 292,812 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 57 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 49, is the weakest lens and counts most in the score. The best first step is fixing the package under a licence on your banned list, worth about 5 points. Adding automated security scanning would lift Production Readiness itself, worth about 4 points. Raising Production Readiness to 62 would lift the score to about 62.

Seven known security holes in the packages the code depends on can be used by attackers. Two pipeline steps install packages that can change without warning, and four buttons or links have no name a screen reader can say. Updating the vulnerable packages, pinning what the pipeline installs and naming the buttons and links would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once, 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 292,812 lines, about €540,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 49 · counts for 46%Performance 60 · counts for 25%Maturity 63 · counts for 14%Accessibility 63 · counts for 8%Code Health 64 · counts for 4%Security and Compliance 78 · counts for 2%Architecture 93 · counts for 1%

If Production Readiness rose from 49 to 62, the lowest score rated Strong, the score would rise from 57 to about 62.

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

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

  • Cyclomatic Complexity · ResearchLab.ResearchLab (cyclomatic 69) frontend/src/pages/ResearchLab.tsx
  • Cyclomatic Complexity · ShannonPortfolio.ShannonPortfolio (cyclomatic 66) frontend/src/components/charts/ShannonPortfolio.tsx
  • Cyclomatic Complexity · historical._walk_bars (cyclomatic 55) agent/src/data_gateway/historical.py
  • Cyclomatic Complexity · _PolicyMixin._derivation (cyclomatic 49) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · HistoryStore.run (cyclomatic 47) agent/src/data_gateway/history_store.py
  • Cyclomatic Complexity · _PolicyMixin._referenced (cyclomatic 45) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · figures.scan_figures (cyclomatic 44) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · _PolicyMixin._validate_figures (cyclomatic 43) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · _PolicyMixin._check_observed (cyclomatic 43) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · IdentityLedger._ingest_resolution (cyclomatic 41) agent/src/agent/instrument_identity.py
  • Cyclomatic Complexity · financial_facts.validate_financial_facts (cyclomatic 41) agent/src/research_artifacts/financial_facts.py
  • Cyclomatic Complexity · gildata_fin_query_tool._normalize_table (cyclomatic 39) agent/src/tools/gildata_fin_query_tool.py
  • Cyclomatic Complexity · sources.normalize (cyclomatic 37) agent/src/data_gateway/sources.py
  • Cyclomatic Complexity · historical.fetch_bars (cyclomatic 36) agent/src/data_gateway/historical.py
  • Cyclomatic Complexity · data_refs.resolve_data_refs (cyclomatic 33) agent/src/tools/data_refs.py
  • Cyclomatic Complexity · HistoryStorageSettings.HistoryStorageSettings (cyclomatic 33) frontend/src/components/settings/HistoryStorageSettings.tsx
  • Cyclomatic Complexity · _EvidenceMixin._ingest_engine_table (cyclomatic 29) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · measurements.measurement_verdicts (cyclomatic 29) agent/evals/harness/measurements.py
  • Cyclomatic Complexity · history_router.fetch_chunk (cyclomatic 28) agent/src/data_gateway/history_router.py
  • Cyclomatic Complexity · GroundingLedger.ingest_tool_result (cyclomatic 27) agent/evals/grounding/ledger.py
  • Cyclomatic Complexity · _PolicyMixin._artifact_scope (cyclomatic 27) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · history_router._normalize (cyclomatic 26) agent/src/data_gateway/history_router.py
  • Cyclomatic Complexity · figures._numbers (cyclomatic 25) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · history_router.plan (cyclomatic 25) agent/src/data_gateway/history_router.py
  • Cyclomatic Complexity · Correlation.CorrelationAnalysis (cyclomatic 25) frontend/src/pages/Correlation.tsx
  • Cyclomatic Complexity · MarketDataGateway._fetch (cyclomatic 24) agent/src/data_gateway/service.py
  • Cyclomatic Complexity · discovery._list_openai_codex_models (cyclomatic 24) agent/src/providers/discovery.py
  • Cyclomatic Complexity · evidence_handoff._observations (cyclomatic 24) agent/src/swarm/evidence_handoff.py
  • Cyclomatic Complexity · SwarmStatusCard.SwarmStatusCard (cyclomatic 24) frontend/src/components/chat/SwarmStatusCard.tsx
  • Cyclomatic Complexity · VolatilitySurfaceGrid.VolatilitySurfaceGrid (cyclomatic 24) frontend/src/components/options/VolatilitySurfaceGrid.tsx
  • Cyclomatic Complexity · figures.parse_figures_block (cyclomatic 23) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · instrument_identity._infer_instrument_type (cyclomatic 23) agent/src/agent/instrument_identity.py
  • Cyclomatic Complexity · market_data._fetch_market_data_direct (cyclomatic 23) agent/src/market_data.py
  • Cyclomatic Complexity · SoftwareUpdateSettings.SoftwareUpdateSettings (cyclomatic 23) frontend/src/components/settings/SoftwareUpdateSettings.tsx
  • Cyclomatic Complexity · _EvidenceMixin._record_backtest_metrics (cyclomatic 22) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_market_data (cyclomatic 22) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · evidence._wrapped_percent_headers (cyclomatic 22) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · _PolicyMixin._indexed_field_ref_candidates (cyclomatic 22) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · instrument_identity._normalize_symbol (cyclomatic 22) agent/src/agent/instrument_identity.py
  • Cyclomatic Complexity · ScanQueue._run (cyclomatic 22) agent/src/data_gateway/scans.py
  • Cyclomatic Complexity · OptionsChainTool.execute (cyclomatic 22) agent/src/tools/options_chain_tool.py
  • Cyclomatic Complexity · reconcile.reconcile_document (cyclomatic 22) agent/src/tools/paper_trade/reconcile.py
  • Cyclomatic Complexity · evidence._document_percent_cells (cyclomatic 21) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · history_source.fetch_chunk (cyclomatic 21) agent/src/data_gateway/history_source.py
  • Cyclomatic Complexity · checkpoint.restore (cyclomatic 21) agent/src/swarm/checkpoint.py
  • Cyclomatic Complexity · OptionsPayoffTool._execute_single (cyclomatic 21) agent/src/tools/options_payoff_tool.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_analysis_result (cyclomatic 20) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · historical.describe_coverage (cyclomatic 20) agent/src/data_gateway/historical.py
  • Cyclomatic Complexity · claude_cli._query_claude_cli_models (cyclomatic 20) agent/src/providers/claude_cli.py
  • Cyclomatic Complexity · volatility.implied_volatility_surface (cyclomatic 20) agent/src/quantlib/volatility.py
  • Cyclomatic Complexity · options.buildVolatilitySurfaceRequest (cyclomatic 20) frontend/src/lib/options.ts
  • Cyclomatic Complexity · _EvidenceMixin._record_backtest_outputs (cyclomatic 19) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_document_text (cyclomatic 19) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · _PolicyMixin._operands_read_as_points (cyclomatic 19) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · measurements.validate_measurements (cyclomatic 19) agent/evals/harness/measurements.py
  • Cyclomatic Complexity · bar_summary.summarize_bars (cyclomatic 19) agent/src/data_gateway/bar_summary.py
  • Cyclomatic Complexity · fanout.acquire_groups (cyclomatic 19) agent/src/data_gateway/fanout.py
  • Cyclomatic Complexity · reads.read (cyclomatic 19) agent/src/data_gateway/reads.py
  • Cyclomatic Complexity · main.installUpdate (cyclomatic 19) desktop/electron/src/main.ts
  • Cyclomatic Complexity · shannon.parseHoldings (cyclomatic 19) frontend/src/lib/shannon.ts
  • Cyclomatic Complexity · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · figures.table_rows (cyclomatic 18) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · figures._currency_code_for_figure (cyclomatic 18) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · calendars.validate (cyclomatic 18) agent/src/data_gateway/calendars.py
  • Cyclomatic Complexity · options.volatilitySurfaceIssue (cyclomatic 18) frontend/src/lib/options.ts
  • Cyclomatic Complexity · FiguresBlock.match (cyclomatic 17) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · policies._records_at (cyclomatic 17) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · assertions._evidence_verdicts (cyclomatic 17) agent/evals/harness/assertions.py
  • Cyclomatic Complexity · settings.get_llm_credentials (cyclomatic 17) agent/src/providers/settings.py
  • Cyclomatic Complexity · execution.freeze_run (cyclomatic 17) agent/src/research_lab/execution.py
  • Cyclomatic Complexity · StrategyBuilder.StrategyBuilder (cyclomatic 17) frontend/src/components/options/StrategyBuilder.tsx
  • Cyclomatic Complexity · validation.bootstrap_sharpe_ci (cyclomatic 16) agent/backtest/validation.py
  • Cyclomatic Complexity · _legacy._show_settings (cyclomatic 16) agent/cli/_legacy.py
  • Cyclomatic Complexity · evidence._metric_kind_for_path (cyclomatic 16) agent/evals/grounding/evidence.py
  • Cyclomatic Complexity · figures._writes_decimal_commas (cyclomatic 16) agent/evals/grounding/figures.py
  • Cyclomatic Complexity · _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) agent/evals/grounding/policies.py
  • Cyclomatic Complexity · __main__.run_history (cyclomatic 16) agent/src/data_gateway/__main__.py
  • Cyclomatic Complexity · HistoryStore.start (cyclomatic 16) agent/src/data_gateway/history_store.py
  • Cyclomatic Complexity · sources.cboe_options (cyclomatic 16) agent/src/data_gateway/sources.py
  • Cyclomatic Complexity · Topic.parse (cyclomatic 16) agent/src/data_gateway/streams.py
  • Cyclomatic Complexity · discovery._list_provider_models (cyclomatic 16) agent/src/providers/discovery.py
  • Cyclomatic Complexity · llm._build_anthropic (cyclomatic 16) agent/src/providers/llm.py
  • Cyclomatic Complexity · HistoryDataTool.execute (cyclomatic 16) agent/src/tools/history_data_tool.py
  • Cyclomatic Complexity · ResearchLabTool.execute (cyclomatic 16) agent/src/tools/research_lab_tool.py
  • Cognitive Complexity · historical._walk_bars (cognitive 114) agent/src/data_gateway/historical.py
  • Cognitive Complexity · HistoryStore.run (cognitive 82) agent/src/data_gateway/history_store.py
  • Cognitive Complexity · _PolicyMixin._validate_figures (cognitive 77) agent/evals/grounding/policies.py
  • Cognitive Complexity · gildata_fin_query_tool._normalize_table (cognitive 76) agent/src/tools/gildata_fin_query_tool.py
  • Cognitive Complexity · historical.fetch_bars (cognitive 75) agent/src/data_gateway/historical.py
  • Cognitive Complexity · _PolicyMixin._check_observed (cognitive 65) agent/evals/grounding/policies.py
  • Cognitive Complexity · measurements.measurement_verdicts (cognitive 65) agent/evals/harness/measurements.py
  • Cognitive Complexity · financial_facts.validate_financial_facts (cognitive 65) agent/src/research_artifacts/financial_facts.py
  • Cognitive Complexity · figures.scan_figures (cognitive 63) agent/evals/grounding/figures.py
  • Cognitive Complexity · _PolicyMixin._referenced (cognitive 63) agent/evals/grounding/policies.py
  • Cognitive Complexity · _PolicyMixin._derivation (cognitive 61) agent/evals/grounding/policies.py
  • Cognitive Complexity · ScanQueue._run (cognitive 55) agent/src/data_gateway/scans.py
  • Cognitive Complexity · sources.normalize (cognitive 55) agent/src/data_gateway/sources.py
  • Cognitive Complexity · IdentityLedger._ingest_resolution (cognitive 52) agent/src/agent/instrument_identity.py
  • Cognitive Complexity · ShannonPortfolio.ShannonPortfolio (cognitive 50) frontend/src/components/charts/ShannonPortfolio.tsx
  • Cognitive Complexity · _EvidenceMixin._ingest_engine_table (cognitive 49) agent/evals/grounding/evidence.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: 404 findings

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

  • Cyclomatic Complexity · _PolicyMixin._derivation (cyclomatic 49) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · figures.scan_figures (cyclomatic 44) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · _IdentityMixin._ingest_resolution (cyclomatic 41) agent/src/agent/grounding/identity.py
  • Cyclomatic Complexity · _PolicyMixin._referenced (cyclomatic 40) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · _PolicyMixin._check_observed (cyclomatic 40) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · _PolicyMixin._validate_figures (cyclomatic 34) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · QVerisSettings.QVerisSettings (cyclomatic 31) frontend/src/components/settings/QVerisSettings.tsx
  • Cyclomatic Complexity · GroundingLedger.ingest_tool_result (cyclomatic 27) agent/src/agent/grounding/ledger.py
  • Cyclomatic Complexity · _PolicyMixin._artifact_scope (cyclomatic 27) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_engine_table (cyclomatic 26) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · figures._numbers (cyclomatic 25) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · loop_grounding.validate_and_release (cyclomatic 25) agent/src/agent/loop_grounding.py
  • Cyclomatic Complexity · Correlation.Correlation (cyclomatic 25) frontend/src/pages/Correlation.tsx
  • Cyclomatic Complexity · settings_routes._list_openai_codex_models (cyclomatic 24) agent/src/api/settings_routes.py
  • Cyclomatic Complexity · identity._infer_instrument_type (cyclomatic 23) agent/src/agent/grounding/identity.py
  • Cyclomatic Complexity · _EvidenceMixin._record_backtest_metrics (cyclomatic 22) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_market_data (cyclomatic 22) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · identity._normalize_symbol (cyclomatic 22) agent/src/agent/grounding/identity.py
  • Cyclomatic Complexity · _PolicyMixin._indexed_field_ref_candidates (cyclomatic 22) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · market_data.fetch_market_data (cyclomatic 22) agent/src/market_data.py
  • Cyclomatic Complexity · QVerisExecuteTool.execute (cyclomatic 22) agent/src/tools/qveris_tool.py
  • Cyclomatic Complexity · figures.parse_figures_block (cyclomatic 21) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · release._correction_line (cyclomatic 21) agent/src/agent/grounding/release.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_analysis_result (cyclomatic 20) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · _ReleaseMixin.redacted_release (cyclomatic 20) agent/src/agent/grounding/release.py
  • Cyclomatic Complexity · claude_cli_models._query_claude_cli_models (cyclomatic 20) agent/src/providers/claude_cli_models.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 · _PolicyMixin._operands_read_as_points (cyclomatic 19) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · figures.table_rows (cyclomatic 18) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · figures._currency_code_for_figure (cyclomatic 18) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · policies._records_at (cyclomatic 17) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · settings_routes._list_provider_models (cyclomatic 17) agent/src/api/settings_routes.py
  • Cyclomatic Complexity · worker._classify_deliverable (cyclomatic 17) agent/src/swarm/worker.py
  • Cyclomatic Complexity · evidence._metric_kind_for_path (cyclomatic 16) agent/src/agent/grounding/evidence.py
  • Cyclomatic Complexity · figures._writes_decimal_commas (cyclomatic 16) agent/src/agent/grounding/figures.py
  • Cyclomatic Complexity · _IdentityMixin.authorize_tool_call (cyclomatic 16) agent/src/agent/grounding/identity.py
  • Cyclomatic Complexity · _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) agent/src/agent/grounding/policies.py
  • Cyclomatic Complexity · preflight._check_llm_provider (cyclomatic 16) agent/src/preflight.py
  • Cognitive Complexity · figures.scan_figures (cognitive 63) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _PolicyMixin._check_observed (cognitive 62) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · _PolicyMixin._derivation (cognitive 61) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · _PolicyMixin._validate_figures (cognitive 58) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · _PolicyMixin._referenced (cognitive 57) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · _IdentityMixin._ingest_resolution (cognitive 52) agent/src/agent/grounding/identity.py
  • Cognitive Complexity · loop_grounding.validate_and_release (cognitive 51) agent/src/agent/loop_grounding.py
  • Cognitive Complexity · figures.parse_figures_block (cognitive 43) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _EvidenceMixin._ingest_engine_table (cognitive 42) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · market_data.fetch_market_data (cognitive 40) agent/src/market_data.py
  • Cognitive Complexity · _PolicyMixin._indexed_field_ref_candidates (cognitive 39) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · settings_routes._list_openai_codex_models (cognitive 39) agent/src/api/settings_routes.py
  • Cognitive Complexity · _EvidenceMixin._ingest_market_data (cognitive 38) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cognitive 37) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · identity._normalize_symbol (cognitive 36) agent/src/agent/grounding/identity.py
  • Cognitive Complexity · _EvidenceMixin._record_backtest_metrics (cognitive 35) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · GroundingLedger.ingest_tool_result (cognitive 35) agent/src/agent/grounding/ledger.py
  • Cognitive Complexity · _PolicyMixin._artifact_scope (cognitive 34) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · figures._numbers (cognitive 32) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · figures.table_rows (cognitive 32) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _EvidenceMixin._record_backtest_outputs (cognitive 31) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · claude_cli_models._query_claude_cli_models (cognitive 31) agent/src/providers/claude_cli_models.py
  • Cognitive Complexity · QVerisSettings.QVerisSettings (cognitive 31) frontend/src/components/settings/QVerisSettings.tsx
  • Cognitive Complexity · _ReleaseMixin.redacted_release (cognitive 30) agent/src/agent/grounding/release.py
  • Cognitive Complexity · _EvidenceMixin._ingest_document_text (cognitive 28) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · _PolicyMixin._operands_read_as_points (cognitive 27) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · identity._infer_instrument_type (cognitive 25) agent/src/agent/grounding/identity.py
  • Cognitive Complexity · evidence._metric_kind_for_path (cognitive 24) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · QVerisExecuteTool.execute (cognitive 24) agent/src/tools/qveris_tool.py
  • Cognitive Complexity · Correlation.Correlation (cognitive 24) frontend/src/pages/Correlation.tsx
  • Cognitive Complexity · figures._fenced_blocks (cognitive 23) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _EvidenceMixin._ingest_analysis_result (cognitive 22) agent/src/agent/grounding/evidence.py
  • Cognitive Complexity · release._correction_line (cognitive 21) agent/src/agent/grounding/release.py
  • Cognitive Complexity · qveris_loader._iter_ohlcv_records (cognitive 19) agent/backtest/loaders/qveris_loader.py
  • Cognitive Complexity · FiguresBlock.match (cognitive 19) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _ReleaseMixin._provenance_note (cognitive 19) agent/src/agent/grounding/release.py
  • Cognitive Complexity · _EnvReadVisitor.visit_Call (cognitive 19) tools/ci_env_var_gate.py
  • Cognitive Complexity · figures._entity (cognitive 18) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · figures._currency_code_for_figure (cognitive 18) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · figures._index_cells (cognitive 18) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · _IdentityMixin.authorize_tool_call (cognitive 18) agent/src/agent/grounding/identity.py
  • Cognitive Complexity · _PolicyMixin._other_call_field_ref_candidates (cognitive 18) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · settings_routes._list_provider_models (cognitive 18) agent/src/api/settings_routes.py
  • Cognitive Complexity · worker._classify_deliverable (cognitive 18) agent/src/swarm/worker.py
  • Cognitive Complexity · DataLoader._fetch_one (cognitive 17) agent/backtest/loaders/qveris_loader.py
  • Cognitive Complexity · _PolicyMixin._unknown_call_field_ref_candidates (cognitive 17) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · policies._records_at (cognitive 17) agent/src/agent/grounding/policies.py
  • Cognitive Complexity · _ReleaseMixin.correction_prompt (cognitive 17) agent/src/agent/grounding/release.py
  • Cognitive Complexity · ChannelRuntime._wait_for_reply (cognitive 17) agent/src/channels/runtime.py
  • Cognitive Complexity · ci_env_var_gate._collect_python_files (cognitive 17) tools/ci_env_var_gate.py
  • Cognitive Complexity · benchmark._infer_market (cognitive 16) agent/backtest/benchmark.py
  • Cognitive Complexity · figures._writes_decimal_commas (cognitive 16) agent/src/agent/grounding/figures.py
  • Cognitive Complexity · helpers._write_env_values (cognitive 16) agent/src/api/helpers.py
  • Cognitive Complexity · capabilities.get_llm_credentials (cognitive 16) agent/src/providers/capabilities.py
  • God Classes · FileTooLong: grounding/policies.py agent/src/agent/grounding/policies.py
  • God Classes · FunctionTooLong: QVerisSettings.QVerisSettings frontend/src/components/settings/QVerisSettings.tsx
  • God Classes · FileTooLong: grounding/evidence.py agent/src/agent/grounding/evidence.py
  • God Classes · FileTooLong: grounding/figures.py agent/src/agent/grounding/figures.py
  • God Classes · TooManyMethods: _PolicyMixin agent/src/agent/grounding/policies.py
  • God Classes · FunctionTooLong: Correlation.Correlation frontend/src/pages/Correlation.tsx
Rebuild cost: about €540,000 · Estimate
Cost to rebuild€180,000 to €890,000, for 2,965 to 9,406 hours of work, about 3.7 person-years for 2 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.8 at a score of 57. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 292,812 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 Banned license finding(s) in License Compliance.
Raises the score by about 5 points · Low effort · License Compliance
2
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 4 points · Medium effort · Security & performance tooling
3
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pyproject.toml.
Raises the score by about 1 point · Low effort · ADR Quality

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 €540,000 to build again, about 3.7 person-years of work. Its weakest lens is Production Readiness, at 49 (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 Banned license finding(s) in License Compliance. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 1 License Compliance 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.5 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 14% on every change. The history of the code shows how much it changes: about 371,395 lines over the last 90 days, which is about 1,506,213 lines a year. At that pace, the extra work comes to an estimated 238.4 to 1430.1 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.

636 modules, with 436 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; 596 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.tools6 agent.src.channels.bus.events7 agent.src.live.mandate.model8 agent.src.providers9 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.agent21 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.channels.base31 frontend.src.components.chat32 agent.src.channels.dingtalk33 agent.src.channels.discord34 agent.src.channels.email35 agent.src.channels.feishu36 agent.src.channels.mochat37 agent.src.channels.qq38 agent.src.channels.slack39 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.tools
6 agent.src.channels.bus.events
7 agent.src.live.mandate.model
8 agent.src.providers
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.agent1
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.lib422
28 frontend.src.pages10
29 frontend.src.stores.agent1
30 agent.src.channels.base21
31 frontend.src.components.chat14631
32 agent.src.channels.dingtalk111
33 agent.src.channels.discord111
34 agent.src.channels.email111
35 agent.src.channels.feishu211
36 agent.src.channels.mochat111
37 agent.src.channels.qq111
38 agent.src.channels.slack111
39 agent.src.channels.websocket111
40 agent.src.channels111111111
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.tools6 agent.src.channels.bus.events7 agent.src.live.mandate.model8 agent.src.providers9 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.agent21 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.channels.base31 frontend.src.components.chat32 agent.src.channels.dingtalk33 agent.src.channels.discord34 agent.src.channels.email35 agent.src.channels.feishu36 agent.src.channels.mochat37 agent.src.channels.qq38 agent.src.channels.slack39 agent.src.channels.websocket40 agent.src.channelsagent.backtest1agent.backtest.engines.base2agent.backtest.optimizers.base3agent.cli4agent.src.agent.tools5agent.src.channels.bus.events6agent.src.live.mandate.model7agent.src.providers8agent.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.agent20agent.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.channels.base30frontend.src.components.chat31agent.src.channels.dingtalk32agent.src.channels.discord33agent.src.channels.email34agent.src.channels.feishu35agent.src.channels.mochat36agent.src.channels.qq37agent.src.channels.slack38agent.src.channels.websocket39agent.src.channels40111124114221012114631111111111211111111111111111111111+596 more modules (most-connected shown)

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

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

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

At a glance — Readiness · 49% · Adequate · gated by D12, P3 ·

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

At a glance — Accessibility · 63% · 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
A03:2025 — Software Supply Chain Failures20High / Critical
A05:2025 — Injection19High / Critical
A01:2025 — Broken Access Control1Medium

Roadmap

Top priorities: 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; 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.

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

Do thisHelpsEffortDimension
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.+4.1 ptsMediumSecurity & performance tooling
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pyproject.toml.+1.1 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.9 ptsMediumAsync & latency hygiene
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.+1.0 ptsMediumArchitecture documentation
Add eslint as package.json scripts and run them in CI.+0.8 ptsMediumTooling
Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with sdk.py, tickerall_loader.py.+0.3 ptsLowKnowledge Freshness
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).+0.6 ptsMediumDR & Backup

File quality

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

FileScoreBandWorst signal
REDACTED3.7MixedDependency Vulnerabilities: High CVE: REDACTED
REDACTED3.7MixedDependency Vulnerabilities: High CVE: REDACTED
REDACTED4.2MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.2MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.4MixedDependency Vulnerabilities: High CVE: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedData Compliance (PII/GDPR): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
agent/src/skills/options-strategy/example_signal_engine.py5.7MixedCyclomatic Complexity: _ShortPremium._run (cyclomatic 17)
agent/src/live/enforcement.py6.0MixedExplicit Debt: TodoComment
REDACTED6.4MixedDependency Vulnerabilities: Medium CVE: REDACTED
REDACTED6.4MixedCyclomatic Complexity: DataLoader._fetch_one (cyclomatic 20)
REDACTED6.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED6.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED6.9MixedDependency Vulnerabilities: Medium CVE: REDACTED

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

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

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

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

Could not be resolved — 13

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

Methodology & how to trust this report

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 82 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 — 82 dimensions across the health lenses
D1D2D3D4D5D6D10D12D13D14D15D16D17D19D20D24D26D27D28D29D30D31D32D34D35D36D37D43D44AC1AC2AC3AC4AC5AC6AX10AX3AX4AX6C2M1M2M3M4P1P10P2P3P4P5P6P7PF3R1R10R2R3R4R5R6R7R8R9S1X1X12X13X14X17X19X2X21X23X24X25X26X27X28X3X30X4X5

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, 2464 of 2486 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 01a1e297-cf76-7ca9-9d6e-d1650bcc3d01.

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 91.7% — 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.
  • 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 834 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,115 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .py, and the python executor ran against the .py half and never executed — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (vitest via `npm ci --ignore-scripts` in frontend/ (965 tests); node:test via `npm ci --ignore-scripts` in tools/wiki/ (12 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
  • D14 License Compliance — measured, with a gap in what it reached — 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 naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their 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.
  • 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 per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): 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 107 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 107 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 107 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 107 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 107 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 107 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, Scala and Rust 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, Scala and Rust 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 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 52 further occurrence(s) are not listed individually; the score already reflects all 92.
  • R2 Cyclomatic Complexity — 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. 79 further occurrence(s) are not listed individually; the score already reflects all 119.
  • X10 Duplicated predicate — 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. 69 further occurrence(s) are not listed individually; the score already reflects all 109.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X29 Per-element action decided by a fixed element — 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • 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. 7 further occurrence(s) are not listed individually; the score already reflects all 47.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • 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.
  • 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

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

sdk.place_order (cyclomatic 30) · ×2agent/src/trading/connectors/alpaca/sdk.py:460
Settings.Settings::submitDataSources (cyclomatic 22) · ×2frontend/src/pages/Settings.tsx:270
Agent.Agent (cyclomatic 364)frontend/src/pages/Agent.tsx:227
Scheduled.Scheduled (cyclomatic 116)frontend/src/pages/Scheduled.tsx:92
AgentLoop._run_bound (cyclomatic 92)REDACTED:386

+ 475 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 364). — Refactoring it lifts Cyclomatic Complexity from 2.0 to about 3.2/10.

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

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

Settings.Settings::submitDataSources (cognitive 22) · ×2frontend/src/pages/Settings.tsx:270
DataLoader.fetch (cognitive 18) · ×2agent/backtest/loaders/akshare_loader.py:126
Agent.Agent (cognitive 418)frontend/src/pages/Agent.tsx:227
AgentLoop._run_bound (cognitive 169)REDACTED:386
options_portfolio.run_options_backtest (cognitive 151)agent/backtest/engines/options_portfolio.py:199

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

What to do

  1. Bring the 46 bodies over 60 down to 60 or less in Cognitive Complexity — start with Agent.Agent (cognitive 418), AgentLoop._run_bound (cognitive 169), options_portfolio.run_options_backtest (cognitive 151). — 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 46 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

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

D3 · God Classes8.0 / 10Strong✓ Tool-verified

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

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

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

146 god class(es) detected.

FileTooLong: cli/_legacy.py · ×89agent/cli/_legacy.py
FunctionTooLong: Scheduled.Scheduled · ×42frontend/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 89 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 (89 warning-level).
  2. Resolve the 42 FunctionTooLong finding(s) in God Classes — start with AlphaZoo.tsx (4), MandateProposalCard.tsx (2), Scheduled.tsx. — One of this dimension's main actionable groups (42 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).

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

D4 · Code Duplication8.0 / 10Strong✓ Tool-verified

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

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

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

274 duplicated block group(s) detected. 5.0 % of the production lines (14,511 of 292,812) are in a reported copy. A further 228 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 15 of the 502 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (8 lines × 2) · ×18agent/backtest/metrics.py:668
Duplicated block (6 lines × 2) · ×17agent/backtest/loaders/fmp_loader.py:312
Duplicated block (7 lines × 2) · ×16agent/backtest/engines/composite.py:363
Duplicated block (9 lines × 2) · ×14agent/backtest/loaders/sina_loader.py:106
Duplicated block (10 lines × 2) · ×11agent/backtest/loaders/futu.py:189

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

What to do

  1. Resolve the 18 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 (18 warning-level).
  2. Resolve the 17 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with _legacy.py (2), fmp_loader.py, base.py. — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 16 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with composite.py, _legacy.py, w4a_patch_blog.py. — One of this dimension's main actionable groups (16 warning-level).

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

2 of 165 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).

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

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

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

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

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

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

Mock-dominated test: saves $provider.name credentials (desktop=$isDesktop) · ×2frontend/src/pages/__tests__/SettingsClaudeCliModels.test.tsx:105

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.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 209 shipped distributions were graded against pypi.org (0 not published there, 197 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

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

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

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

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

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

Secret scan ran and found no leaked secrets. 1 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.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 216 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 209 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (7 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. 20 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).

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

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

Top hotspots: frontend/src/pages/Agent.tsx (18×364=6552); REDACTED (60×92=5520); agent/evals/grounding/policies.py (52×49=2548) Repeated repair below the complexity floor: agent/backtest/engines/_market_hooks.py (27 of 33 changes were fixes); agent/backtest/loaders/registry.py (20 of 33 changes were fixes); agent/src/agent/context.py (18 of 24 changes were fixes)

Hotspot: frontend/src/pages/Agent.tsx · ×146frontend/src/pages/Agent.tsx:227
Repeated repair: agent/backtest/engines/_market_hooks.py · ×71agent/backtest/engines/_market_hooks.py:522

What to do

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

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

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

69 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 821 of the 1453 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 · ×4
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 292812 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).

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

2 of 2 documentation facets pass in full. 17 document(s) read across 4 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 foundpyproject.toml:108

What to do

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

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

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 97% · ceiling Documented

2 of 346 judged comments only repeat the code they sit on (0.6 %). 14 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 Cohesion2.0 / 10Critical✓ Tool-verified

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

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

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

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

Projects may be oversized for their cohesion · ×2REDACTED:1

What to do

  1. Resolve the 2 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with REDACTED, package.json. — One of this dimension's main actionable groups (2 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.5 / 10Critical✓ Tool-verified

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

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

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

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

19 finding(s): 0 critical, 4 high, 13 medium, 2 low. semgrep hit a parse error in 8 file(s) — `frontend/src/components/options/__tests__/OptionsChainTable.test.tsx` (line 20), `frontend/src/components/run/PositionsTab.tsx` (line 41), `frontend/src/i18n/index.ts` (line 38), `frontend/src/lib/__tests__/api.test.ts` (line 95, line 211), `frontend/src/pages/Agent.tsx`, … (+3 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

+ 5 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 Vulnerabilities5.2 / 10Adequate✓ 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 5.2 / 10 · rule-coverage 100% · ceiling Documented

15 finding(s): 0 critical, 7 high, 6 medium, 2 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 7 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (7 issue-level).
  2. Resolve the 6 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (6 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.8 / 10Adequategated by 2 critical findings✓ 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.8 / 10 · rule-coverage 100% · ceiling Documented

15 of 821 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 821 of the 1453 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

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

What to do

  1. Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with sdk.py, tickerall_loader.py. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 13 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 (13 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 / 10Exemplary✓ 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

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.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 209 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. (×5) — frontend/src/components/chat/RunnerBudgetControls.tsx:48, frontend/src/components/portfolio/ConnectionCenter.tsx:242, 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:129, …

What to do

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

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

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

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

  • 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:147, 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:46
  • <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.
AX10 · Code composition9.5 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

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

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

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

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

M2 · Architecture 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 structure10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

P10 · Library API & versioning10.0 / 10Exemplary○ 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 6 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. — REDACTED:71

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

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.

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
  • `exercise` is async and calls subprocess.check_output — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — tools/gateway_full_scan_probe.py:43
  • `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
  • `readFileSync` in `loadPage` 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. — tools/wiki/dom.mjs:11
  • `readFileSync` in `json` 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. — tools/wiki/dom.mjs:19
  • `readFileSync` in `load` 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. — tools/wiki/dom.mjs:25

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

R10 · Code Duplication7.0 / 10Strong✓ Tool-verified

React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): 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. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.

  • 24 duplicated blocks under frontend/src/ have copies in at least two of the sibling directories components, pages — 8 of them are reported below, and 16 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:48 — 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:674 · frontend/src/lib/api.ts:843 — 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:674
  • frontend/src/pages/Settings.tsx:658 · frontend/src/pages/Settings.tsx:693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — frontend/src/pages/Settings.tsx:658
  • 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
  • frontend/src/pages/Settings.tsx:621 · frontend/src/pages/Settings.tsx:735 — 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:621
  • 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:308 · frontend/src/lib/swarmStatus.ts:328 · frontend/src/lib/swarmStatus.ts:347 — 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:308
  • frontend/src/pages/Settings.tsx:509 · frontend/src/pages/Settings.tsx:659 · frontend/src/pages/Settings.tsx:694 — 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:509
  • frontend/src/components/portfolio/ConnectionCenter.tsx:74 · frontend/src/components/portfolio/ConnectionCenter.tsx:103 — the two spans are one implementation copied and then locally edited — 73 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/portfolio/ConnectionCenter.tsx:74
  • frontend/src/components/settings/HistoryStorageSettings.tsx:15 · frontend/src/components/settings/SourcePrioritySettings.tsx:34 — 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/settings/HistoryStorageSettings.tsx:15
  • frontend/src/pages/Agent.tsx:1062 · frontend/src/pages/Agent.tsx:1099 — both copies are in the same file, so extract the 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:1062
  • 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:255 · frontend/src/pages/Settings.tsx:300 — 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:255
  • 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/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:1045 · frontend/src/pages/Agent.tsx:1083 — 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:1045
  • frontend/src/pages/Agent.tsx:1485 · frontend/src/pages/Agent.tsx:1590 — both copies are in the same file, so extract the 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:1485
  • 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:84 · frontend/src/pages/Settings.tsx:99 — 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:84
  • frontend/src/pages/Settings.tsx:526 · frontend/src/pages/Settings.tsx:678 · frontend/src/pages/Settings.tsx:713 — 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:526
  • frontend/src/pages/Settings.tsx:550 · frontend/src/pages/Settings.tsx:563 · frontend/src/pages/Settings.tsx:576 — 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:550
  • 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

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.

  • OptionsLab has cyclomatic complexity 47 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/OptionsLab.tsx:61
  • (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:539
  • Settings has cyclomatic complexity 45 and cognitive complexity 41; 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:42
  • 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:921
  • 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
  • ConnectionCard has cyclomatic complexity 37 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/portfolio/ConnectionCenter.tsx:183
  • 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
  • buildPayoffRequest has cyclomatic complexity 33 and cognitive complexity 35; 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:373
  • ShannonPortfolio has cyclomatic complexity 32 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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/charts/ShannonPortfolio.tsx:31
  • 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
  • applySwarmEvent has cyclomatic complexity 30 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/lib/swarmStatus.ts:209
  • 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
  • ResearchArtifacts has cyclomatic complexity 26 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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/ResearchArtifacts.tsx:80
  • 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
  • (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:1401
  • 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
  • submitDataSources has cyclomatic complexity 22 and cognitive complexity 22; 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/Settings.tsx:270
  • Agent has cyclomatic complexity 22 and cognitive complexity 20; 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:227
  • ResearchLab has cyclomatic complexity 22 and cognitive complexity 19; 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/ResearchLab.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:237
  • metricSentiment has cyclomatic complexity 21 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 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/formatters.ts:69
  • StudioTab has cyclomatic complexity 21 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/RunDetail.tsx:622
  • volatilitySurfaceIssue has cyclomatic complexity 20 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 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:292
  • errorFromResponse has cyclomatic complexity 20 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 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/api.ts:403
  • buildVolatilitySurfaceRequest has cyclomatic complexity 20 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/lib/options.ts:258
  • verifyWindowsUpdateCandidate has cyclomatic complexity 20 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/electron/src/update-verification.ts:53
  • OptionsChainTable has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/options/OptionsChainTable.tsx:139
  • DetailView has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/AlphaZoo.tsx:457
  • CorrelationAnalysis has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Correlation.tsx:44
  • SoftwareUpdateSettings has cyclomatic complexity 20 and cognitive complexity 17; 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/SoftwareUpdateSettings.tsx:5
  • (anonymous) has cyclomatic complexity 20 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/components/settings/ChannelSettings.tsx:235
  • parseHoldings has cyclomatic complexity 19 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 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/shannon.ts:37
  • AccountCard has cyclomatic complexity 19 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — frontend/src/pages/Portfolio.tsx:547
  • ChartTab has cyclomatic complexity 19 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/pages/RunDetail.tsx:825
  • installUpdate has cyclomatic complexity 19 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/electron/src/main.ts:305
  • (anonymous) has cyclomatic complexity 18 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/pages/Agent.tsx:1829
R3 · Large Files5.0 / 10Adequate✓ Tool-verified

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

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

  • frontend/src/lib/api.ts has 2208 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 1858 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 728 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/lib/options.ts has 579 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/options.ts: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 565 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — 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/lib/swarmStatus.ts has 492 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/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/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/pages/ResearchArtifacts.tsx has 408 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/ResearchArtifacts.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.5 / 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. (×23) — desktop/electron/src/main.ts:1, REDACTED:1, desktop/electron/src/update-verification.ts:1, …

What to do

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

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

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

R6 · 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 29 application, 15 tooling and 112 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 (29 application, 15 tooling, 112 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) — frontend/package.json:18, frontend/package.json:19

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.

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.

  • `resolve_data_refs` is public and takes `value: Any` from its caller, and it calls itself at line 27 (`resolve_data_refs`) with a piece of `value` (and at line 31) — and nowhere in `resolve_data_refs` 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 `resolve_data_refs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — agent/src/tools/data_refs.py:27
  • `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 760) and hands it to `_validate_node`, which calls itself at line 748 (`_validate_node`) with a piece of `instance` (and at line 757) — 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:748
  • `canonicalize` is public and takes `value: Any` from its caller, and it calls itself at line 160 (`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:160
  • `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 379 (`_json_safe`) with a piece of `value` (and at line 381) — 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:379
  • `write_validation_json` is public, takes a document from its caller (line 540) and hands it to `_json_safe`, which calls itself at line 528 (`_json_safe`) with a piece of `value` (and at line 530, line 534, line 536) — 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:528

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

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.

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

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 605 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:605
  • `info` at line 615 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:615
  • `exception` at line 1067 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:1067
  • `warning` at line 376 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:376
  • `info` at line 674 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:674

What to do

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

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

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

  • ~1.1 `!` null assertions per 1k TypeScript source lines — 35 assertion(s) across the 31912 source line(s) of the 134 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. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.

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

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 Health64%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity63%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness49%Adequate — gated by D12, P3Capped 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.
Accessibility63%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 — 40 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 — 41 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.
  • D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
  • 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 does not read html yet; not measured.
  • D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go 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
  • 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); 301 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, Scala and Rust, 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 this repository defines no table or model of its own, so there is no database schema here for this check to judge
  • P9 Domain vs controller coverage — coverage data present for 34 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 scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • 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.
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 12% of this repository's production lines — python (263,140 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — X29 reached only 12% of this repository's production lines — python (263,140 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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 — 23 finding(s)
D30 · Dependency Vulnerabilities · High CVE · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
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:129 — 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:151 — 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
D34 · Knowledge Freshness · Orphaned knowledge · ×2
  • 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.
  • Orphaned knowledge agent/backtest/loaders/tickerall_loader.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.
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
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 — 2314 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×146
  • Hotspot: frontend/src/pages/Agent.tsx frontend/src/pages/Agent.tsx:227 — frontend/src/pages/Agent.tsx changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 364 in Agent.Agent at line 227. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: REDACTED REDACTED:386 — REDACTED changed 60 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 92 in AgentLoop._run_bound at line 386. 42 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: agent/evals/grounding/policies.py agent/evals/grounding/policies.py:1957 — agent/evals/grounding/policies.py changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in _PolicyMixin._derivation at line 1957. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/evals/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:6402 — agent/cli/_legacy.py changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in _legacy.main at line 6402. 12 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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:1290 — agent/backtest/engines/base.py changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in BaseEngine._execute_bars at line 1290. 25 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: frontend/src/lib/api.ts frontend/src/lib/api.ts:403 — frontend/src/lib/api.ts changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in api.errorFromResponse at line 403. 22 of those changes were fix/bug commits, and the other 42 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: agent/backtest/runner.py agent/backtest/runner.py:2060 — agent/backtest/runner.py changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in runner.fetch_data_map at line 2060. 25 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/evals/grounding/figures.py agent/evals/grounding/figures.py:1254 — agent/evals/grounding/figures.py changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in figures.scan_figures at line 1254. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/evals/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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: agent/mcp_server.py agent/mcp_server.py:1059 — agent/mcp_server.py changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in mcp_server.alpha_bench at line 1059. 21 of those changes were fix/bug commits, and the other 38 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/src/swarm/worker.py agent/src/swarm/worker.py:557 — agent/src/swarm/worker.py changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in worker._run_worker_impl at line 557. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/providers/llm.py agent/src/providers/llm.py:1454 — agent/src/providers/llm.py changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in llm.build_llm at line 1454. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/evals/grounding/evidence.py agent/evals/grounding/evidence.py:1199 — agent/evals/grounding/evidence.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in _EvidenceMixin._ingest_engine_table at line 1199. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/evals/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/backtest/engines/options_portfolio.py agent/backtest/engines/options_portfolio.py:705 — 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 705. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/Settings.tsx frontend/src/pages/Settings.tsx:42 — frontend/src/pages/Settings.tsx changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in Settings.Settings at line 42. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/portfolio/service.py agent/src/portfolio/service.py:962 — agent/src/portfolio/service.py changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in PortfolioService._collect_source at line 962. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: agent/src/data_gateway/historical.py agent/src/data_gateway/historical.py:121 — agent/src/data_gateway/historical.py changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in historical._walk_bars at line 121. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/data_gateway/historical.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/market_data_tool.py agent/src/tools/market_data_tool.py:172 — agent/src/tools/market_data_tool.py changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in MarketDataTool.execute at line 172. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/tools/market_data_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/providers/chat.py agent/src/providers/chat.py:495 — agent/src/providers/chat.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in ChatLLM.stream_chat at line 495. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/providers/chat.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:220 — agent/src/market_data.py changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in market_data._fetch_market_data_direct at line 220. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/symbol_search_tool.py agent/src/tools/symbol_search_tool.py:573 — agent/src/tools/symbol_search_tool.py changed 19 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 573. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: frontend/src/pages/RunDetail.tsx frontend/src/pages/RunDetail.tsx:124 — frontend/src/pages/RunDetail.tsx changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in RunDetail.RunDetail at line 124. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: tools/gateway_combined_report.py tools/gateway_combined_report.py:36 — tools/gateway_combined_report.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in gateway_combined_report.summarize at line 36. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- tools/gateway_combined_report.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.
  • + 121 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×89
  • FileTooLong: cli/_legacy.py agent/cli/_legacy.py — FileTooLong — 4729 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4229 over it, 9.46× 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 — 1846 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1346 over it, 3.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grounding/policies.py agent/evals/grounding/policies.py — FileTooLong — 1811 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1311 over it, 3.62× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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 — 1625 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1125 over it, 3.25× 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 — 1501 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1001 over it, 3.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: agent/mcp_server.py agent/mcp_server.py — FileTooLong — 1488 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 988 over it, 2.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: backtest/runner.py agent/backtest/runner.py — FileTooLong — 1390 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 890 over it, 2.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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 — 1280 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 780 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 — 1204 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 704 over it, 2.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grounding/evidence.py agent/evals/grounding/evidence.py — FileTooLong — 1178 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 678 over it, 2.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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: providers/llm.py agent/src/providers/llm.py — FileTooLong — 1121 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 621 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: REDACTED REDACTED — FileTooLong — 1068 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 568 over it, 2.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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 — 1018 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 518 over it, 2.04× 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 — 989 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 489 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.
  • + 64 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×71
  • Repeated repair: agent/backtest/engines/_market_hooks.py agent/backtest/engines/_market_hooks.py:522 — agent/backtest/engines/_market_hooks.py changed 33 times in last 90 days and 27 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 522), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: route Japan data safely and reduce agent acquisition overhead”; “fix(backtest): recognise bare three-digit Zhengzhou futures codes”; “fix(backtest): recognise bare codes for every China futures product the engine prices (#2177)”; “fix(backtest): select and report the benchmark actually evaluated”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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:539 — agent/backtest/loaders/registry.py changed 33 times in last 90 days and 20 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 registry.refresh_source_order_overrides at line 539), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: route Japan data safely and reduce agent acquisition overhead”; “fix(gateway): bound source recovery and paced work under mixed load”; “fix: complete October 11-12 maintenance and research updates”; “fix(loaders): retire mootdx from the default A-share chain and health canary”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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:352 — agent/src/agent/context.py changed 24 times in last 90 days and 18 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 352), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: guide generated Python and MCP data reads through gateway”; “fix(grounding): bind bare integers to exact source quotations”; “fix(agent): recover from native claude-cli tool attempts”; “fix: complete October 11-12 maintenance and research updates”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/backtest/loaders/yfinance_loader.py agent/backtest/loaders/yfinance_loader.py:285 — agent/backtest/loaders/yfinance_loader.py changed 13 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is DataLoader.fetch at line 285), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: route Japan data safely and reduce agent acquisition overhead”; “fix(gateway): overlap cold market routes and verify exchange calendars”; “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)”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/backtest/loaders/yfinance_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/loaders/yahoo_loader.py agent/backtest/loaders/yahoo_loader.py:148 — agent/backtest/loaders/yahoo_loader.py changed 12 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is yahoo_loader._rows_to_frame at line 148), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: route Japan data safely and reduce agent acquisition overhead”; “fix(gateway): overlap cold market routes and verify exchange calendars”; “fix(gateway): bound source recovery and paced work under mixed load”; “fix: complete October 11-12 maintenance and research updates”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: REDACTED REDACTED:164 — REDACTED changed 9 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is backtester.run_shadow_backtest at line 164), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: correct shadow capital and committee completion contracts”; “fix(shadow-account): stop the result cache hiding rules and currencies (#2075)”; “fix(shadow-account): overtrading span uses the true trading window”; “fix(shadow-account): exclude already explained trades from overtrading pnl”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: agent/src/api/sessions_routes.py agent/src/api/sessions_routes.py:56 — agent/src/api/sessions_routes.py changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is sessions_routes._strip_prompt_wrappers at line 56), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/src/session/search.py agent/src/session/search.py:44 — agent/src/session/search.py changed 8 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 15 (its worst body is search._search_snippet at line 44), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): preserve Unicode records and handoff summaries”; “fix(session): keep deletion retryable when search purge fails”; “fix(session): clear the search index when a session is deleted”; “fix(session): anchor search snippets to native token matches”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/session/search.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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/benchmark.py agent/backtest/benchmark.py:103 — agent/backtest/benchmark.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 11 (its worst body is benchmark.resolve_benchmark at line 103), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(backtest): buy the benchmark at the first evaluated open, as the strategy is”; “fix(backtest): select and report the benchmark actually evaluated”; “fix(benchmark): give hong kong runs a fetchable 2828.HK benchmark”; “fix: complete October 11-12 maintenance and research updates”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/backtest/benchmark.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 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is DataLoader.fetch at line 126), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/mcp.py agent/src/tools/mcp.py:662 — agent/src/tools/mcp.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MCPServerAdapter._build_client at line 662), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: guide generated Python and MCP data reads through gateway”; “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”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: 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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/src/quantlib/risk.py agent/src/quantlib/risk.py:327 — agent/src/quantlib/risk.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is risk.drawdown_distribution_analysis at line 327), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: expose exact research calculations through existing tools”; “fix: preserve research evidence and validate committee risk basis”; “fix(risk): count drawdown days on the civil calendar”; “fix(quantlib): preserve exact decimal tail ranks in historical risk (#1950)”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/quantlib/risk.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 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is base.zscore_by_group at line 99), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/backtest/engines/crypto.py agent/backtest/engines/crypto.py:511 — agent/backtest/engines/crypto.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is CryptoEngine._execute_open_order at line 511), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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: agent/backtest/loaders/baostock_loader.py agent/backtest/loaders/baostock_loader.py:43 — agent/backtest/loaders/baostock_loader.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 13 (its worst body is baostock_loader._session_admission at line 43), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: defer unstarted SDK reads and close gateway probe catalogs”; “fix: preserve scan deadlines across source failures and SDK contention”; “fix(loaders): preserve bounded BaoStock 0.9.4 connections”; “fix: complete September 28 reliability reviews and broker documentation”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/tools/paper_trade/rules.py agent/src/tools/paper_trade/rules.py:198 — agent/src/tools/paper_trade/rules.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 8 (its worst body is MarketRules.band_rejection at line 198), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(paper-trade): gate volume-share sell overdrafts”; “fix(paper-trade): version volume-share matching as pt-rules-v5”; “fix(paper-trade): match symbols on a shared timeline”; “fix(paper-trade): cancel price-limit market orders (#2176)”. 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +08:00' --full-history --no-merges -- agent/src/tools/paper_trade/rules.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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/stooq_loader.py agent/backtest/loaders/stooq_loader.py:268 — agent/backtest/loaders/stooq_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 10 (its worst body is stooq_loader._parse_csv at line 268), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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/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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 20:31:38 +08:00' --until='2026-11-15 20:31:38 +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.
  • + 46 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×42
  • 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:42 — FunctionTooLong — Settings runs 626 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 526 over it, 6.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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: ResearchArtifacts.ResearchArtifacts frontend/src/pages/ResearchArtifacts.tsx:80 — FunctionTooLong — ResearchArtifacts runs 303 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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: StrategyBuilder.StrategyBuilder frontend/src/components/options/StrategyBuilder.tsx:25 — FunctionTooLong — StrategyBuilder runs 237 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× 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 228 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 128 over it, 2.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: 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: 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: OptionsLab.OptionsLab frontend/src/pages/OptionsLab.tsx:61 — FunctionTooLong — OptionsLab runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: PositionsTab.PositionsTab frontend/src/components/run/PositionsTab.tsx:98 — 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: 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: 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.CorrelationAnalysis frontend/src/pages/Correlation.tsx:44 — FunctionTooLong — CorrelationAnalysis 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.
  • FunctionTooLong: VolatilitySurfaceGrid.VolatilitySurfaceGrid frontend/src/components/options/VolatilitySurfaceGrid.tsx:25 — FunctionTooLong — VolatilitySurfaceGrid runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 17 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:1014 — `.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:1362 — `.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:1537 — `.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.
R4 · Test Coverage · No test reaches this file · ×23
  • 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 REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file 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 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/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/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-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/scripts/gen_sitemap.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/scripts/prerender_docs.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/update.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 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/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 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 (8 lines × 2) · ×18
  • Duplicated block (8 lines × 2) agent/backtest/metrics.py:668 — agent/backtest/metrics.py:668-675 | agent/backtest/metrics.py:731-738 — both copies are in the same file, so extract the block into 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:509 — agent/mcp_server.py:509-516 | 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:509` 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/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/src/tools/financial_research_artifact_tool.py:219 — agent/src/tools/financial_research_artifact_tool.py:219-226 | agent/src/tools/research_artifact_tool.py:65-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/tools/financial_research_artifact_tool.py:219` 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 (8 lines × 2) agent/backtest/loaders/nobitex.py:278 — agent/backtest/loaders/nobitex.py:278-285 | agent/backtest/loaders/wallex.py:262-269 — 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 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) agent/src/factors/zoo/gtja191/alpha_049.py:56 — agent/src/factors/zoo/gtja191/alpha_049.py:56-63 | agent/src/factors/zoo/gtja191/alpha_050.py:56-63 — 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 (8 lines × 2) agent/backtest/risk_xray.py:39 — agent/backtest/risk_xray.py:39-46 | agent/src/tools/backtest_summary.py:210-222 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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.
  • Duplicated block (8 lines × 2) tools/gateway_minute_restart_probe.py:271 — tools/gateway_minute_restart_probe.py:271-278 | tools/gateway_ten_job_restart_probe.py:437-444 — 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 `tools/gateway_minute_restart_probe.py:271` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×17
  • 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/cli/_legacy.py:4006 — agent/cli/_legacy.py:4006-4011 | agent/cli/_legacy.py:4227-4232 — both copies are in the same file, so extract the block into 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:4932 — agent/cli/_legacy.py:4932-4937 | agent/cli/_legacy.py:4958-4963 — both copies are in the same file, so extract the 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/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_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/providers/settings.py:139 — agent/src/providers/settings.py:139-144 | 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/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/quantlib/crossvalidation.py:596 — agent/src/quantlib/crossvalidation.py:596-601 | agent/src/quantlib/crossvalidation.py:615-620 — both copies are in the same file, so extract the 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 (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/research_lab/execution.py:23 — agent/src/research_lab/execution.py:23-28 | agent/src/tools/goal_tool.py:64-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) 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/backtest/loaders/gildata_loader.py:214 — agent/backtest/loaders/gildata_loader.py:214-219 | agent/src/tools/gildata_srv.py:102-107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `agent/backtest/loaders/gildata_loader.py:220` calls `get`, `isinstance`, `ValueError` and `agent/src/tools/gildata_srv.py:109` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) 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.
  • Duplicated block (6 lines × 2) tools/gateway_soak_history.py:178 — tools/gateway_soak_history.py:178-183 | tools/gateway_soak_history.py:216-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) tools/gateway_minute_restart_probe.py:71 — tools/gateway_minute_restart_probe.py:71-76 | tools/gateway_ten_job_restart_probe.py:121-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×16
  • Duplicated block (7 lines × 2) agent/backtest/engines/composite.py:363 — agent/backtest/engines/composite.py:363-369 | 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/cli/_legacy.py:4673 — agent/cli/_legacy.py:4673-4679 | agent/cli/_legacy.py:5193-5199 — both copies are in the same file, so extract the 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:4673` 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) 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/backtest/loaders/tushare.py:248 — agent/backtest/loaders/tushare.py:248-254 | agent/backtest/loaders/tushare.py:380-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) agent/src/factors/zoo/gtja191/alpha_009.py:49 — agent/src/factors/zoo/gtja191/alpha_009.py:49-55 | agent/src/factors/zoo/gtja191/alpha_068.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 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 (7 lines × 2) agent/src/quantlib/combination.py:83 — agent/src/quantlib/combination.py:83-89 | agent/src/quantlib/neutralization.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 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 (7 lines × 2) agent/src/tools/goal_tool.py:306 — agent/src/tools/goal_tool.py:306-312 | agent/src/tools/goal_tool.py:375-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (7 lines × 2) agent/backtest/run_card.py:376 — agent/backtest/run_card.py:376-382 | agent/src/tools/backtest_summary.py:200-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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/factors/zoo/gtja191/alpha_063.py:49 — agent/src/factors/zoo/gtja191/alpha_063.py:49-55 | agent/src/factors/zoo/gtja191/alpha_067.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 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 (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:150-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) agent/src/tools/etf_holdings_tool.py:708 — agent/src/tools/etf_holdings_tool.py:708-714 | agent/src/tools/institutional_holdings_tool.py:1643-1649 — 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:463 — agent/src/tools/financial_statements_tool.py:463-469 | agent/src/tools/northbound_tool.py:51-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 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) tools/gateway_history_validate.py:34 — tools/gateway_history_validate.py:34-40 | tools/gateway_ten_job_restart_probe.py:153-159 — 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 after the matched lines, `tools/gateway_history_validate.py:42` calls `now`, `isoformat` and `tools/gateway_ten_job_restart_probe.py:161` 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 (7 lines × 2) tools/gateway_minute_restart_probe.py:180 — tools/gateway_minute_restart_probe.py:180-186 | tools/gateway_ten_job_restart_probe.py:336-342 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×14
  • Duplicated block (9 lines × 2) agent/backtest/loaders/sina_loader.py:106 — agent/backtest/loaders/sina_loader.py:106-114 | REDACTED:230-238 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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/mcp_server.py:709 — agent/mcp_server.py:709-717 | agent/mcp_server.py:818-826 — both copies are in the same file, so extract the 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/system_routes.py:474 — agent/src/api/system_routes.py:474-482 | agent/src/api/system_routes.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) 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) agent/src/quantlib/risk.py:276 — agent/src/quantlib/risk.py:276-284 | agent/src/quantlib/risk.py:485-493 — both copies are in the same file, so extract the block into 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:72 — agent/src/skills/tushare/scripts/fund_data_example.py:72-80 | agent/src/skills/tushare/scripts/stock_data_example.py:72-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 (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/live/mandate/commit.py:178 — agent/src/live/mandate/commit.py:178-186 | agent/src/live/runtime/reconcile.py:600-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 (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.
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/data_refs.py:27 — `resolve_data_refs` is public and takes `value: Any` from its caller, and it calls itself at line 27 (`resolve_data_refs`) with a piece of `value` (and at line 31) — and nowhere in `resolve_data_refs` 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 `resolve_data_refs` 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:748 — `validate_payload` is public, takes a document from its caller (line 760) and hands it to `_validate_node`, which calls itself at line 748 (`_validate_node`) with a piece of `instance` (and at line 757) — 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:160 — `canonicalize` is public and takes `value: Any` from its caller, and it calls itself at line 160 (`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:379 — `write_run_card` is public, takes a document from its caller (line 168) and hands it to `_json_safe`, which calls itself at line 379 (`_json_safe`) with a piece of `value` (and at line 381) — 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:528 — `write_validation_json` is public, takes a document from its caller (line 540) and hands it to `_json_safe`, which calls itself at line 528 (`_json_safe`) with a piece of `value` (and at line 530, line 534, line 536) — 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: BaseEngine agent/backtest/engines/base.py:538 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: _PolicyMixin agent/evals/grounding/policies.py:460 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: 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 (10 lines × 2) · ×11
  • Duplicated block (10 lines × 2) agent/backtest/loaders/futu.py:189 — agent/backtest/loaders/futu.py:189-198 | 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/instrument_identity.py:709 — agent/src/agent/instrument_identity.py:709-718 | agent/src/agent/instrument_identity.py:728-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×10
  • Edited copy of a member (16 corresponding lines) agent/src/factors/zoo/gtja191/alpha_050.py:49 — agent/src/factors/zoo/gtja191/alpha_050.py:49-65 | agent/src/factors/zoo/gtja191/alpha_051.py:49-64 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/tools/paper_trade/data.py:151 — agent/src/tools/paper_trade/data.py:151-166 | agent/src/tools/paper_trade/data_5m.py:239-266 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/goal/store.py:110 — agent/src/goal/store.py:110-125 | agent/src/strategy_store/sqlite_store.py:135-153 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/factors/zoo/gtja191/alpha_116.py:54 — agent/src/factors/zoo/gtja191/alpha_116.py:54-69 | agent/src/factors/zoo/gtja191/alpha_147.py:54-70 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/factors/zoo/gtja191/alpha_102.py:54 — agent/src/factors/zoo/gtja191/alpha_102.py:54-70 | agent/src/factors/zoo/gtja191/alpha_162.py:54-69 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/skills/technical-basic/example_signal_engine.py:14 — agent/src/skills/technical-basic/example_signal_engine.py:14-29 | agent/src/tools/technical_indicator_tool.py:175-193 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/factors/zoo/alpha101/alpha_083.py:67 — agent/src/factors/zoo/alpha101/alpha_083.py:67-82 | agent/src/factors/zoo/gtja191/alpha_114.py:55-73 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/api/security.py:470 — agent/src/api/security.py:470-504 | agent/src/api/security.py:644-659 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/factors/zoo/gtja191/alpha_125.py:55 — agent/src/factors/zoo/gtja191/alpha_125.py:55-70 | agent/src/factors/zoo/gtja191/alpha_130.py:55-71 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) agent/src/quantlib/fundmath.py:264 — agent/src/quantlib/fundmath.py:264-283 | agent/src/quantlib/fundmath.py:287-302 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×10
  • Edited copy of a member (8 corresponding lines) REDACTED:281 — REDACTED:281-288 | REDACTED:299-307 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/cli/commands/chat.py:31 — agent/cli/commands/chat.py:31-38 | agent/cli/commands/session.py:71-78 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/agent/tool_progress.py:43 — agent/src/agent/tool_progress.py:43-52 | agent/src/agent/tool_results.py:32-39 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/live/runtime/jobstore.py:234 — agent/src/live/runtime/jobstore.py:234-252 | agent/src/scheduled_research/store.py:284-291 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/live/order_guard.py:798 — agent/src/live/order_guard.py:798-810 | agent/src/live/sdk_order_gate.py:1087-1094 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/evals/grounding/evidence.py:358 — agent/evals/grounding/evidence.py:358-375 | agent/src/trading/connectors/binance/shaping.py:12-19 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/factors/zoo/alpha101/alpha_015.py:60 — agent/src/factors/zoo/alpha101/alpha_015.py:60-68 | agent/src/factors/zoo/alpha101/alpha_050.py:55-62 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/factors/zoo/alpha101/alpha_038.py:55 — agent/src/factors/zoo/alpha101/alpha_038.py:55-62 | agent/src/factors/zoo/alpha101/alpha_040.py:55-62 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/factors/zoo/alpha101/alpha_033.py:55 — agent/src/factors/zoo/alpha101/alpha_033.py:55-62 | agent/src/factors/zoo/gtja191/alpha_185.py:54-65 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) agent/src/factors/zoo/alpha101/alpha_042.py:55 — agent/src/factors/zoo/alpha101/alpha_042.py:55-62 | agent/src/factors/zoo/gtja191/alpha_120.py:55-67 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×10
  • 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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.
  • Duplicated block (12 lines × 2) tools/gateway_full_scan_probe.py:138 — tools/gateway_full_scan_probe.py:138-149 | tools/gateway_mixed_memory_probe.py:141-152 — 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) tools/gateway_minute_restart_probe.py:104 — tools/gateway_minute_restart_probe.py:104-115 | tools/gateway_ten_job_restart_probe.py:249-260 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11 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:6212 — agent/cli/_legacy.py:6212-6222 | agent/cli/_legacy.py:6302-6312 — both copies are in the same file, so extract the 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:6212` 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/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/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:233 — agent/src/trading/service.py:233-243 | agent/src/trading/service.py:281-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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/api/system_routes.py:324 — agent/src/api/system_routes.py:324-334 | agent/src/api/system_routes.py:370-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.
  • Duplicated block (11 lines × 2) agent/src/channelsui/cli_apps_api.py:9 — agent/src/channelsui/cli_apps_api.py:9-19 | agent/src/channelsui/mcp_presets_api.py:9-19 — 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/api/sessions_routes.py:595 — agent/src/api/sessions_routes.py:595-605 | agent/src/api/sessions_routes.py:697-707 — both copies are in the same file, so extract the 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. 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 (11 lines × 2) tools/gateway_full_scan_probe.py:189 — tools/gateway_full_scan_probe.py:189-199 | tools/gateway_mixed_memory_probe.py:184-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.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×10
  • 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/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:173-181 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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/frozen.py:48 — agent/backtest/frozen.py:48-52 | agent/src/research_lab/execution.py:104-108 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) 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:316 — agent/src/tools/paper_trade/engine.py:316-320 | agent/src/tools/paper_trade/engine.py:339-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) tools/gateway_route_benchmark.py:91 — tools/gateway_route_benchmark.py:91-95 | tools/gateway_stream_latency.py:102-106 — 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 · Edited copy of a member (10 corresponding lines) · ×9
  • Edited copy of a member (10 corresponding lines) agent/src/factors/base.py:234 — agent/src/factors/base.py:234-249 | agent/src/factors/base.py:253-262 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/factors/zoo/alpha101/alpha_066.py:55 — agent/src/factors/zoo/alpha101/alpha_066.py:55-68 | agent/src/factors/zoo/gtja191/alpha_087.py:50-59 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/backtest/loaders/yahoo_client.py:350 — agent/backtest/loaders/yahoo_client.py:350-359 | agent/backtest/loaders/yahoo_client.py:412-421 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/tools/paper_trade/calendar.py:275 — agent/src/tools/paper_trade/calendar.py:275-293 | agent/src/tools/paper_trade/engine.py:98-107 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/hypotheses/registry.py:371 — agent/src/hypotheses/registry.py:371-380 | agent/src/trading/connections.py:172-191 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/tools/sdm_status_tool.py:187 — agent/src/tools/sdm_status_tool.py:187-200 | agent/src/tools/sdm_status_tool.py:205-214 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/tools/options_payoff_tool.py:414 — agent/src/tools/options_payoff_tool.py:414-423 | agent/src/tools/options_payoff_tool.py:427-437 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/goal/store.py:965 — agent/src/goal/store.py:965-976 | agent/src/goal/store.py:980-989 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) agent/src/live/runtime/jobstore.py:197 — agent/src/live/runtime/jobstore.py:197-215 | agent/src/scheduled_research/store.py:264-273 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×8
  • Edited copy of a member (13 corresponding lines) agent/src/factors/zoo/alpha101/alpha_089.py:86 — agent/src/factors/zoo/alpha101/alpha_089.py:86-98 | agent/src/factors/zoo/alpha101/alpha_097.py:86-98 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/src/factors/zoo/alpha101/alpha_063.py:91 — agent/src/factors/zoo/alpha101/alpha_063.py:91-105 | agent/src/factors/zoo/alpha101/alpha_093.py:86-98 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/src/factors/zoo/alpha101/alpha_065.py:60 — agent/src/factors/zoo/alpha101/alpha_065.py:60-73 | agent/src/factors/zoo/alpha101/alpha_078.py:60-72 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/src/providers/chat.py:370 — agent/src/providers/chat.py:370-389 | agent/src/providers/chat.py:392-404 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/backtest/loaders/base.py:368 — agent/backtest/loaders/base.py:368-380 | agent/backtest/loaders/base.py:384-396 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/cli/commands/show.py:25 — agent/cli/commands/show.py:25-37 | agent/cli/commands/show.py:54-66 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/backtest/optimizers/turnover_aware.py:146 — agent/backtest/optimizers/turnover_aware.py:146-158 | agent/backtest/optimizers/mean_variance.py:21-34 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) agent/src/factors/zoo/gtja191/alpha_126.py:54 — agent/src/factors/zoo/gtja191/alpha_126.py:54-66 | agent/src/factors/zoo/gtja191/alpha_150.py:54-67 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×8
  • 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/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:59 — agent/src/tools/lockup_expiry_tool.py:59-73 | agent/src/tools/stock_news_tool.py:59-74 — 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 · Edited copy of a member (21 corresponding lines) · ×7
  • 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.
  • Edited copy of a member (21 corresponding lines) agent/src/tools/gildata_fin_query_tool.py:131 — agent/src/tools/gildata_fin_query_tool.py:131-151 | agent/src/tools/gildata_stock_selection_tool.py:40-60 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) agent/src/factors/zoo/gtja191/alpha_055.py:49 — agent/src/factors/zoo/gtja191/alpha_055.py:49-69 | agent/src/factors/zoo/gtja191/alpha_137.py:54-87 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) REDACTED:1006 — REDACTED:1006-1033 | REDACTED:1040-1060 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) agent/mcp_server.py:3057 — agent/mcp_server.py:3057-3077 | agent/mcp_server.py:3082-3102 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) agent/backtest/loaders/futu.py:68 — agent/backtest/loaders/futu.py:68-88 | agent/backtest/loaders/longbridge.py:113-133 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) agent/src/tools/fred_macro_tool.py:210 — agent/src/tools/fred_macro_tool.py:210-233 | agent/src/tools/research_reports_tool.py:240-260 — 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 (17 corresponding lines) · ×7
  • Edited copy of a member (17 corresponding lines) agent/src/factors/zoo/alpha101/alpha_079.py:87 — agent/src/factors/zoo/alpha101/alpha_079.py:87-103 | agent/src/factors/zoo/alpha101/alpha_095.py:61-77 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/src/factors/zoo/alpha101/alpha_049.py:88 — agent/src/factors/zoo/alpha101/alpha_049.py:88-104 | agent/src/factors/zoo/alpha101/alpha_051.py:88-104 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/src/providers/settings.py:130 — agent/src/providers/settings.py:130-146 | REDACTED:50-76 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/src/factors/zoo/gtja191/alpha_119.py:55 — agent/src/factors/zoo/gtja191/alpha_119.py:55-71 | agent/src/factors/zoo/gtja191/alpha_138.py:55-71 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/backtest/runner.py:1056 — agent/backtest/runner.py:1056-1072 | agent/backtest/runner.py:1076-1092 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/backtest/engines/china_a.py:163 — agent/backtest/engines/china_a.py:163-180 | agent/backtest/engines/china_a.py:184-200 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) agent/src/live/runtime/flatten.py:427 — agent/src/live/runtime/flatten.py:427-448 | agent/src/tools/prediction_market_tool.py:286-302 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) agent/backtest/loaders/nobitex.py:220 — agent/backtest/loaders/nobitex.py:220-233 | agent/backtest/loaders/wallex.py:219-232 — 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 49 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:220` 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:3268 — agent/cli/_legacy.py:3268-3281 | agent/cli/_legacy.py:3285-3298 — both copies are in the same file, so extract the 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:3057 — agent/mcp_server.py:3057-3070 | agent/mcp_server.py:3082-3097 — both copies are in the same file, so extract the 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:108 — agent/src/preflight.py:108-121 | agent/src/preflight.py:127-140 — both copies are in the same file, so extract the 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:123` calls `lower`, `get_claude_cli_auth_status` and `agent/src/preflight.py:142` 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/tools/get_fundamentals_tool.py:129 — agent/src/tools/get_fundamentals_tool.py:129-142 | agent/src/tools/market_data_tool.py:173-189 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/tools/get_fundamentals_tool.py:127` calls `public_data_read` and `agent/src/tools/market_data_tool.py:170` 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/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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×7
  • 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 tools/gateway_full_scan_probe.py:43 — `exercise` is async and calls subprocess.check_output — 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.
  • Sync-over-async blocking tools/wiki/dom.mjs:11 — `readFileSync` in `loadPage` 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 tools/wiki/dom.mjs:19 — `readFileSync` in `json` 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 tools/wiki/dom.mjs:25 — `readFileSync` in `load` 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×6
  • Edited copy of a member (19 corresponding lines) agent/backtest/metrics.py:526 — agent/backtest/metrics.py:526-562 | agent/backtest/metrics.py:569-587 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) agent/scripts/w4a_patch_blog.py:136 — agent/scripts/w4a_patch_blog.py:136-154 | agent/scripts/w4a_patch_blog.py:158-176 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) agent/src/live/runtime/jobstore.py:166 — agent/src/live/runtime/jobstore.py:166-193 | agent/src/scheduled_research/store.py:242-260 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) agent/src/live/mandate/commit.py:168 — agent/src/live/mandate/commit.py:168-186 | agent/src/live/runtime/reconcile.py:577-608 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) agent/backtest/loaders/nobitex.py:109 — agent/backtest/loaders/nobitex.py:109-127 | agent/backtest/loaders/wallex.py:106-125 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) agent/src/skills/candlestick/example_signal_engine.py:107 — agent/src/skills/candlestick/example_signal_engine.py:107-125 | agent/src/skills/candlestick/example_signal_engine.py:150-168 — 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 (23 corresponding lines) · ×6
  • Edited copy of a member (23 corresponding lines) agent/src/quantlib/copula.py:63 — agent/src/quantlib/copula.py:63-87 | agent/src/quantlib/copula.py:104-126 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) agent/src/trading/connectors/dhan/sdk.py:287 — agent/src/trading/connectors/dhan/sdk.py:287-310 | agent/src/trading/connectors/shoonya/sdk.py:284-306 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) agent/src/quantlib/fundmath.py:1068 — agent/src/quantlib/fundmath.py:1068-1090 | agent/src/quantlib/fundmath.py:1964-1990 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) agent/src/skills/tushare/scripts/fund_data_example.py:64 — agent/src/skills/tushare/scripts/fund_data_example.py:64-86 | agent/src/skills/tushare/scripts/stock_data_example.py:64-87 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) agent/src/live/order_guard.py:766 — agent/src/live/order_guard.py:766-795 | agent/src/live/sdk_order_gate.py:1061-1083 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) agent/src/live/runtime/jobstore.py:106 — agent/src/live/runtime/jobstore.py:106-129 | agent/src/scheduled_research/store.py:105-127 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×6
  • Edited copy of a member (12 corresponding lines) agent/mcp_server.py:275 — agent/mcp_server.py:275-287 | agent/mcp_server.py:303-314 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) agent/src/tools/_arguments.py:9 — agent/src/tools/_arguments.py:9-34 | agent/src/tools/strategy_discovery_tool.py:113-124 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) agent/src/agent/instrument_identity.py:708 — agent/src/agent/instrument_identity.py:708-719 | agent/src/agent/instrument_identity.py:726-737 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) agent/src/strategy_discovery/facade.py:85 — agent/src/strategy_discovery/facade.py:85-96 | agent/src/tools/taiwan_stock_data_tool.py:102-114 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) agent/src/factors/zoo/alpha101/alpha_061.py:56 — agent/src/factors/zoo/alpha101/alpha_061.py:56-67 | agent/src/factors/zoo/gtja191/alpha_154.py:56-72 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) agent/mcp_server.py:178 — agent/mcp_server.py:178-200 | agent/src/api/security.py:119-130 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×6
  • Edited copy of a member (9 corresponding lines) agent/src/tools/paper_trade/engine.py:210 — agent/src/tools/paper_trade/engine.py:210-218 | agent/src/tools/paper_trade/reconcile.py:123-135 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) agent/src/trading/service.py:1113 — agent/src/trading/service.py:1113-1129 | agent/src/trading/service.py:1223-1231 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) agent/cli/commands/slash_router.py:125 — agent/cli/commands/slash_router.py:125-153 | agent/cli/main.py:90-98 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) agent/src/trading/connectors/kis/sdk.py:885 — agent/src/trading/connectors/kis/sdk.py:885-894 | agent/src/trading/connectors/upbit/sdk.py:617-625 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) agent/src/factors/zoo/gtja191/alpha_136.py:54 — agent/src/factors/zoo/gtja191/alpha_136.py:54-67 | agent/src/factors/zoo/alpha101/alpha_014.py:55-63 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) agent/src/factors/zoo/alpha101/alpha_058.py:86 — agent/src/factors/zoo/alpha101/alpha_058.py:86-94 | agent/src/factors/zoo/alpha101/alpha_059.py:86-95 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×6
  • Edited copy of a member (7 corresponding lines) agent/src/factors/zoo/alpha101/alpha_024.py:88 — agent/src/factors/zoo/alpha101/alpha_024.py:88-107 | agent/src/factors/zoo/gtja191/alpha_098.py:49-55 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) agent/src/tools/financial_statements_tool.py:473 — agent/src/tools/financial_statements_tool.py:473-479 | agent/src/tools/sec_filings_tool.py:326-339 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) agent/src/tools/goal_tool.py:25 — agent/src/tools/goal_tool.py:25-32 | agent/src/hypotheses/registry.py:50-56 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) agent/src/market_data.py:211 — agent/src/market_data.py:211-217 | agent/src/tools/get_fundamentals_tool.py:37-44 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) agent/mcp_server.py:2491 — agent/mcp_server.py:2491-2514 | agent/src/channels/mochat.py:931-937 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tools/gateway_combined_report.py:27 — tools/gateway_combined_report.py:27-33 | tools/gateway_full_scan_report.py:21-27 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×6
  • Edited copy of a member (4 corresponding lines) agent/src/factors/zoo/gtja191/alpha_053.py:49 — agent/src/factors/zoo/gtja191/alpha_053.py:49-52 | agent/src/factors/zoo/gtja191/alpha_058.py:49-52 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) agent/src/quantlib/combination.py:76 — agent/src/quantlib/combination.py:76-79 | agent/src/quantlib/neutralization.py:42-45 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) agent/backtest/binance_account_reconciliation.py:27 — agent/backtest/binance_account_reconciliation.py:27-30 | agent/backtest/binance_tolerance_calibration.py:24-27 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) agent/cli/ui/rail.py:216 — agent/cli/ui/rail.py:216-219 | agent/cli/ui/transcript.py:167-170 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) REDACTED:410 — REDACTED:410-413 | agent/src/channels/registry.py:233-237 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) agent/src/factors/zoo/academic/mkt_rf.py:56 — agent/src/factors/zoo/academic/mkt_rf.py:56-59 | agent/src/factors/zoo/academic/rmw.py:56-60 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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:77 — agent/src/tools/block_trades_tool.py:77-93 | agent/src/tools/northbound_tool.py:184-200 — 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.
AC2 · Forms & labels · <fieldset> without a <legend> · ×5
  • <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:242 — 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.
  • <fieldset> without a <legend> frontend/src/pages/ResearchLab.tsx:140 — 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.
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:46 — <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 · Edited copy of a member (25 corresponding lines) · ×5
  • 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.
  • Edited copy of a member (25 corresponding lines) agent/src/channels/feishu.py:1389 — agent/src/channels/feishu.py:1389-1413 | agent/src/channels/feishu.py:1416-1447 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) agent/src/memory/compression.py:84 — agent/src/memory/compression.py:84-108 | agent/src/memory/semantic_links.py:74-101 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) agent/src/tools/path_utils.py:323 — agent/src/tools/path_utils.py:323-348 | agent/src/tools/path_utils.py:384-408 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) agent/src/trading/connectors/dhan/sdk.py:254 — agent/src/trading/connectors/dhan/sdk.py:254-279 | agent/src/trading/connectors/shoonya/sdk.py:252-276 — 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 · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (10 members, 50+ identical tokens) 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 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/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 | agent/src/trading/connectors/mt5/_client.py: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 · Edited copy of a member (15 corresponding lines) · ×5
  • Edited copy of a member (15 corresponding lines) agent/src/tools/remember_tool.py:102 — agent/src/tools/remember_tool.py:102-122 | agent/src/tools/remember_tool.py:169-183 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) agent/backtest/loaders/yahoo_client.py:332 — agent/backtest/loaders/yahoo_client.py:332-346 | agent/backtest/loaders/yahoo_client.py:391-408 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) agent/src/factors/zoo/gtja191/alpha_160.py:54 — agent/src/factors/zoo/gtja191/alpha_160.py:54-68 | agent/src/factors/zoo/gtja191/alpha_174.py:54-68 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) agent/src/trading/connectors/longbridge/sdk.py:392 — agent/src/trading/connectors/longbridge/sdk.py:392-411 | agent/src/trading/connectors/okx/sdk.py:299-313 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) tools/gateway_minute_restart_probe.py:302 — tools/gateway_minute_restart_probe.py:302-318 | tools/gateway_ten_job_restart_probe.py:474-488 — 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 (11 corresponding lines) · ×5
  • Edited copy of a member (11 corresponding lines) agent/src/trading/connectors/etoro/sdk.py:182 — agent/src/trading/connectors/etoro/sdk.py:182-196 | agent/src/trading/connectors/etoro/sdk.py:208-218 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) agent/src/tools/stock_news_tool.py:389 — agent/src/tools/stock_news_tool.py:389-399 | agent/src/tools/stock_news_tool.py:402-413 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) agent/src/tools/trading_connector_tool.py:369 — agent/src/tools/trading_connector_tool.py:369-379 | agent/src/tools/trading_connector_tool.py:524-535 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) agent/src/skills/tushare/scripts/fund_data_example.py:36 — agent/src/skills/tushare/scripts/fund_data_example.py:36-46 | agent/src/skills/tushare/scripts/stock_data_example.py:36-46 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) agent/src/agent/trace.py:270 — agent/src/agent/trace.py:270-284 | agent/src/governance/ledger.py:356-366 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×5
  • Edited copy of a member (3 corresponding lines) agent/src/br_data/cvm_funds.py:52 — agent/src/br_data/cvm_funds.py:52-55 | agent/src/br_data/cvm_companies.py:47-49 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) agent/backtest/binance_account_reconciliation.py:34 — agent/backtest/binance_account_reconciliation.py:34-36 | agent/backtest/binance_shadow_evidence.py:244-246 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) agent/src/factors/zoo/alpha101/alpha_026.py:55 — agent/src/factors/zoo/alpha101/alpha_026.py:55-62 | agent/src/factors/zoo/gtja191/alpha_005.py:49-51 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) agent/src/factors/zoo/gtja191/alpha_041.py:50 — agent/src/factors/zoo/gtja191/alpha_041.py:50-52 | agent/src/factors/zoo/gtja191/alpha_090.py:50-52 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) REDACTED:1659 — REDACTED:1659-1661 | agent/src/api/security.py:670-672 — These two members are one piece of code written twice and then edited apart: 3 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 (6 corresponding lines) · ×5
  • Edited copy of a member (6 corresponding lines) agent/src/tools/etf_holdings_tool.py:690 — agent/src/tools/etf_holdings_tool.py:690-704 | agent/src/tools/tushare_fallbacks.py:55-60 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) agent/src/trading/connectors/etoro/sdk.py:153 — agent/src/trading/connectors/etoro/sdk.py:153-161 | agent/src/trading/connectors/longbridge/sdk.py:307-312 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) agent/src/shadow_account/codegen.py:66 — agent/src/shadow_account/codegen.py:66-74 | agent/src/shadow_account/reporter.py:289-294 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) agent/src/trading/connectors/binance/sdk.py:868 — agent/src/trading/connectors/binance/sdk.py:868-873 | agent/src/trading/connectors/okx/sdk.py:621-628 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) agent/src/trading/connectors/alpaca/sdk.py:853 — agent/src/trading/connectors/alpaca/sdk.py:853-860 | agent/src/trading/connectors/upbit/sdk.py:629-634 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (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.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×5
  • 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:139 — agent/src/tools/get_fundamentals_tool.py:139-145 | agent/src/tools/get_fundamentals_tool.py:146-152 | agent/src/tools/market_data_tool.py:186-192 — 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/src/factors/zoo/gtja191/alpha_043.py:49 — agent/src/factors/zoo/gtja191/alpha_043.py:49-55 | agent/src/factors/zoo/gtja191/alpha_084.py:49-55 | agent/src/factors/zoo/gtja191/alpha_094.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/backtest/loaders/mt5_loader.py:128 — agent/backtest/loaders/mt5_loader.py:128-134 | 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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×5
  • Duplicated block (15 lines × 2 locations) frontend/src/components/settings/HistoryStorageSettings.tsx:15 — frontend/src/components/settings/HistoryStorageSettings.tsx:15 · frontend/src/components/settings/SourcePrioritySettings.tsx:34 — 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/Agent.tsx:1062 — frontend/src/pages/Agent.tsx:1062 · frontend/src/pages/Agent.tsx:1099 — both copies are in the same file, so extract the block into 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:255 — frontend/src/pages/Settings.tsx:255 · frontend/src/pages/Settings.tsx:300 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 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:84 — frontend/src/pages/Settings.tsx:84 · frontend/src/pages/Settings.tsx:99 — 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.
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 — 626 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 226 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.
  • 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 · Edited copy of a member (32 corresponding lines) · ×4
  • 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.
  • Edited copy of a member (32 corresponding lines) agent/src/tools/skill_writer_tool.py:350 — agent/src/tools/skill_writer_tool.py:350-381 | agent/src/tools/skill_writer_tool.py:385-420 — 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.
  • Edited copy of a member (32 corresponding lines) agent/cli/onboard.py:217 — agent/cli/onboard.py:217-248 | agent/cli/onboard.py:253-287 — 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.
  • Edited copy of a member (32 corresponding lines) agent/src/channels/feishu.py:1641 — agent/src/channels/feishu.py:1641-1673 | agent/src/channels/feishu.py:1693-1724 — 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 · 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:4645 — agent/cli/_legacy.py:4645-4689 | agent/cli/_legacy.py:4720-4739 | agent/cli/_legacy.py:5100-5136 | agent/cli/_legacy.py:5157-5208 — 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 · Edited copy of a member (26 corresponding lines) · ×4
  • Edited copy of a member (26 corresponding lines) agent/src/config/writer.py:118 — agent/src/config/writer.py:118-151 | agent/src/tools/background_store.py:167-192 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) REDACTED:1508 — REDACTED:1508-1533 | REDACTED:1537-1566 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) agent/src/trading/connectors/etoro/instruments.py:459 — agent/src/trading/connectors/etoro/instruments.py:459-484 | agent/src/trading/connectors/etoro/sdk.py:480-505 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) agent/backtest/engines/china_a.py:204 — agent/backtest/engines/china_a.py:204-229 | agent/backtest/engines/india_equity.py:129-166 — 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 · Edited copy of a member (28 corresponding lines) · ×4
  • Edited copy of a member (28 corresponding lines) agent/backtest/optimizers/max_diversification.py:19 — agent/backtest/optimizers/max_diversification.py:19-48 | agent/backtest/optimizers/mean_variance.py:37-64 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) agent/src/skills/okx-market/scripts/candle_data_example.py:18 — agent/src/skills/okx-market/scripts/candle_data_example.py:18-45 | agent/src/skills/okx-market/scripts/candle_data_example.py:49-76 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) agent/src/channels/mochat.py:551 — agent/src/channels/mochat.py:551-582 | agent/src/channels/mochat.py:585-612 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) agent/src/skills/candlestick/example_signal_engine.py:415 — agent/src/skills/candlestick/example_signal_engine.py:415-442 | agent/src/skills/candlestick/example_signal_engine.py:446-473 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×4
  • Edited copy of a member (14 corresponding lines) agent/src/trading/connectors/okx/sdk.py:79 — agent/src/trading/connectors/okx/sdk.py:79-93 | agent/src/trading/connectors/shoonya/sdk.py:91-104 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) agent/src/factors/base.py:335 — agent/src/factors/base.py:335-348 | agent/src/factors/base.py:352-365 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) agent/cli/_legacy.py:968 — agent/cli/_legacy.py:968-995 | agent/src/api/sessions_routes.py:263-276 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) agent/src/factors/zoo/gtja191/alpha_155.py:54 — agent/src/factors/zoo/gtja191/alpha_155.py:54-68 | agent/src/factors/zoo/gtja191/alpha_151.py:54-67 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×4
  • Edited copy of a member (22 corresponding lines) agent/src/trading/connectors/etoro/copy_trading.py:53 — agent/src/trading/connectors/etoro/copy_trading.py:53-74 | agent/src/trading/connectors/etoro/copy_trading.py:85-125 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) agent/src/quantlib/impact.py:128 — agent/src/quantlib/impact.py:128-149 | agent/src/quantlib/impact.py:256-292 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) agent/src/skills/candlestick/example_signal_engine.py:293 — agent/src/skills/candlestick/example_signal_engine.py:293-314 | agent/src/skills/candlestick/example_signal_engine.py:318-339 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) agent/src/quantlib/valuation/contracts.py:139 — agent/src/quantlib/valuation/contracts.py:139-160 | agent/src/quantlib/valuation/dcf.py:227-251 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×4
  • Edited copy of a member (27 corresponding lines) agent/src/trading/connectors/futu/sdk.py:308 — agent/src/trading/connectors/futu/sdk.py:308-334 | agent/src/trading/connectors/futu/sdk.py:338-365 — 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.
  • Edited copy of a member (27 corresponding lines) agent/backtest/loaders/eastmoney_client.py:145 — agent/backtest/loaders/eastmoney_client.py:145-174 | agent/src/tools/iwencai_tool.py:102-128 — 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.
  • Edited copy of a member (27 corresponding lines) agent/backtest/engines/china_futures.py:246 — agent/backtest/engines/china_futures.py:246-272 | agent/backtest/engines/global_futures.py:281-307 — 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.
  • Edited copy of a member (27 corresponding lines) agent/src/live/order_guard.py:586 — agent/src/live/order_guard.py:586-616 | agent/src/live/sdk_order_gate.py:864-890 — 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 · Duplicated block (12–13 lines × 2) · ×4
  • 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/tools/gildata_fin_query_tool.py:139 — agent/src/tools/gildata_fin_query_tool.py:139-151 | agent/src/tools/gildata_stock_selection_tool.py:49-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) 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 (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) agent/cli/_legacy.py:4672 — agent/cli/_legacy.py:4672-4677 | agent/cli/_legacy.py:4723-4728 | agent/cli/_legacy.py:5192-5197 — 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:3065 — agent/mcp_server.py:3065-3070 | agent/mcp_server.py:3092-3097 | agent/mcp_server.py:3199-3204 — 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/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.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×4
  • 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:1045 — frontend/src/pages/Agent.tsx:1045 · frontend/src/pages/Agent.tsx:1083 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) frontend/src/pages/Agent.tsx:1485 — frontend/src/pages/Agent.tsx:1485 · frontend/src/pages/Agent.tsx:1590 — both copies are in the same file, so extract the block into 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.
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:147 — 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 · Edited copy of a member (20 corresponding lines) · ×3
  • Edited copy of a member (20 corresponding lines) agent/backtest/loaders/akshare_loader.py:246 — agent/backtest/loaders/akshare_loader.py:246-265 | agent/backtest/loaders/akshare_loader.py:274-293 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) agent/backtest/metrics.py:449 — agent/backtest/metrics.py:449-471 | agent/backtest/metrics.py:475-494 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) agent/src/quantlib/fundmath.py:174 — agent/src/quantlib/fundmath.py:174-193 | agent/src/quantlib/impact.py:75-100 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×3
  • Edited copy of a member (5 corresponding lines) agent/src/factors/zoo/alpha101/alpha_053.py:55 — agent/src/factors/zoo/alpha101/alpha_053.py:55-64 | agent/src/factors/zoo/gtja191/alpha_002.py:49-53 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) agent/backtest/run_card.py:285 — agent/backtest/run_card.py:285-289 | REDACTED:53-59 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) agent/backtest/loaders/fmp_loader.py:60 — agent/backtest/loaders/fmp_loader.py:60-75 | agent/backtest/loaders/gildata_codes.py:52-56 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) agent/backtest/runner.py:1170 — agent/backtest/runner.py:1170-1191 | agent/backtest/runner.py:1249-1270 — both copies are in the same file, so extract the 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:1170` 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/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.
  • Duplicated block (16 lines × 2) agent/src/factors/zoo/gtja191/alpha_003.py:49 — agent/src/factors/zoo/gtja191/alpha_003.py:49-64 | agent/src/factors/zoo/gtja191/alpha_059.py:49-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 `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 (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:223 — agent/cli/onboard.py:223-236 | agent/cli/onboard.py:262-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/cli/onboard.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.
  • Duplicated block (13–14 lines × 2) agent/src/agent/tool_lifecycle.py:606 — agent/src/agent/tool_lifecycle.py:606-618 | agent/src/agent/tool_lifecycle.py:660-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×3
  • Duplicated block (13 lines × 3) agent/backtest/loaders/alphavantage_loader.py:147 — agent/backtest/loaders/alphavantage_loader.py:147-159 | agent/backtest/loaders/finnhub_loader.py:212-224 | agent/backtest/loaders/fmp_loader.py:129-141 — 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/alphavantage_loader.py:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 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 (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) agent/cli/_legacy.py:5044 — agent/cli/_legacy.py:5044-5055 | agent/cli/_legacy.py:5109-5120 | agent/cli/_legacy.py:5172-5183 — 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:5044` 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:5187` calls `isinstance` and `agent/cli/_legacy.py:5057` 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:415-426 | agent/backtest/validation.py:541-557 — 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:87-96 — 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:4868 — agent/cli/_legacy.py:4868-4878 | agent/cli/_legacy.py:4968-4977 — both copies are in the same file, so extract the block into 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 (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.
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.
X2 · Cancellation propagation · Async function without AbortSignal · ×3
  • 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 })`.
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 22) frontend/src/pages/Settings.tsx:270 — Settings.Settings::submitDataSources 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. 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:232 — 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:270 — 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:232 — 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.
D2 · Cognitive Complexity · DataLoader.fetch (cognitive 18) · ×2
  • DataLoader.fetch (cognitive 18) agent/backtest/loaders/akshare_loader.py:126 — DataLoader.fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DataLoader.fetch (cognitive 18) agent/backtest/loaders/eastmoney_loader.py:71 — DataLoader.fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) agent/mcp_server.py:904 — agent/mcp_server.py:904-969 | 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.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×2
  • Edited copy of a member (44 corresponding lines) agent/src/portfolio/normalization.py:254 — agent/src/portfolio/normalization.py:254-297 | agent/src/portfolio/normalization.py:338-398 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) agent/src/api/alpha_routes.py:265 — agent/src/api/alpha_routes.py:265-311 | agent/src/api/alpha_routes.py:317-360 — These two members are one piece of code written twice and then edited apart: 44 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 (57 corresponding lines) · ×2
  • Edited copy of a member (57 corresponding lines) agent/src/quantlib/crossvalidation.py:233 — agent/src/quantlib/crossvalidation.py:233-289 | agent/src/quantlib/crossvalidation.py:497-560 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (57 corresponding lines) agent/backtest/runner.py:1137 — agent/backtest/runner.py:1137-1193 | agent/backtest/runner.py:1205-1272 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×2
  • Edited copy of a member (29 corresponding lines) agent/src/tools/web_search_tool.py:70 — agent/src/tools/web_search_tool.py:70-101 | agent/src/tools/web_search_tool.py:105-133 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) agent/src/live/order_guard.py:545 — agent/src/live/order_guard.py:545-575 | agent/src/live/sdk_order_gate.py:832-860 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×2
  • Edited copy of a member (31 corresponding lines) agent/src/skills/candlestick/example_signal_engine.py:347 — agent/src/skills/candlestick/example_signal_engine.py:347-377 | agent/src/skills/candlestick/example_signal_engine.py:381-411 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) agent/src/channels/feishu.py:1792 — agent/src/channels/feishu.py:1792-1823 | agent/src/channels/feishu.py:1826-1856 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×2
  • Edited copy of a member (18 corresponding lines) agent/src/factors/zoo/gtja191/alpha_115.py:54 — agent/src/factors/zoo/gtja191/alpha_115.py:54-71 | agent/src/factors/zoo/gtja191/alpha_140.py:54-73 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) agent/src/factors/zoo/alpha101/alpha_009.py:76 — agent/src/factors/zoo/alpha101/alpha_009.py:76-93 | agent/src/factors/zoo/alpha101/alpha_010.py:76-95 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 21+ corresponding lines) agent/src/api/sessions_routes.py:280 — agent/src/api/sessions_routes.py:280-300 | agent/src/api/sessions_routes.py:304-326 | agent/src/api/sessions_routes.py:355-376 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) agent/mcp_server.py:1035 — agent/mcp_server.py:1035-1055 | agent/mcp_server.py:1252-1305 | agent/mcp_server.py:2543-2564 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 24+ corresponding lines) agent/src/trading/connectors/kis/sdk.py:248 — agent/src/trading/connectors/kis/sdk.py:248-271 | agent/src/trading/connectors/toss/sdk.py:180-204 | agent/src/trading/connectors/trading212/sdk.py:163-195 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) agent/backtest/loaders/eastmoney_client.py:290 — agent/backtest/loaders/eastmoney_client.py:290-337 | agent/src/tools/market_screener_tool.py:122-168 | agent/src/tools/northbound_tool.py:131-154 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 8+ corresponding lines) REDACTED:1153 — REDACTED:1153-1160 | REDACTED:1169-1182 | REDACTED:1185-1194 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) agent/src/trading/connectors/etoro/instruments.py:147 — agent/src/trading/connectors/etoro/instruments.py:147-154 | agent/src/trading/connectors/toss/sdk.py:604-612 | agent/src/trading/connectors/trading212/sdk.py:501-508 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 6+ corresponding lines) REDACTED:1148 — REDACTED:1148-1156 | agent/src/live/order_guard.py:835-841 | agent/src/live/sdk_order_gate.py:1098-1103 | REDACTED:228-233 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) agent/src/factors/zoo/qlib158/klow.py:27 — agent/src/factors/zoo/qlib158/klow.py:27-32 | agent/src/factors/zoo/qlib158/klow2.py:27-33 | agent/src/factors/zoo/qlib158/kup.py:27-32 | agent/src/factors/zoo/qlib158/kup2.py:27-33 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 6+ corresponding lines) agent/src/channels/mochat.py:80 — agent/src/channels/mochat.py:80-85 | agent/src/live/enforcement.py:412-417 | agent/src/trading/connectors/robinhood/extractor.py:127-132 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) agent/src/factors/zoo/qlib158/kmid2.py:27 — agent/src/factors/zoo/qlib158/kmid2.py:27-32 | agent/src/factors/zoo/qlib158/ksft.py:27-32 | agent/src/factors/zoo/qlib158/ksft2.py:27-32 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (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 (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) agent/backtest/loaders/nobitex.py:162 — agent/backtest/loaders/nobitex.py:162-188 | agent/backtest/loaders/wallex.py:160-186 — 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 49 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:162` 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:161` calls `sorted` and `agent/backtest/loaders/wallex.py:159` 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 (27 lines × 2) agent/src/factors/zoo/gtja191/alpha_172.py:54 — agent/src/factors/zoo/gtja191/alpha_172.py:54-80 | agent/src/factors/zoo/gtja191/alpha_186.py:54-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.
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 (20 lines × 2) · ×2
  • 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.
  • Duplicated block (20 lines × 2) agent/src/tools/pattern_tool.py:236 — agent/src/tools/pattern_tool.py:236-255 | agent/src/tools/pattern_tool.py:271-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. 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. 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) · ×2
  • Duplicated block (19 lines × 3) agent/src/factors/zoo/gtja191/alpha_149.py:56 — agent/src/factors/zoo/gtja191/alpha_149.py:56-74 | 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.
  • Duplicated block (19 lines × 3) tools/gateway_history_restart_probe.py:68 — tools/gateway_history_restart_probe.py:68-86 | tools/gateway_minute_restart_probe.py:129-149 | tools/gateway_ten_job_restart_probe.py:307-327 — 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 (21 lines × 2) · ×2
  • Duplicated block (21 lines × 2) agent/src/skills/candlestick/example_signal_engine.py:347 — agent/src/skills/candlestick/example_signal_engine.py:347-367 | agent/src/skills/candlestick/example_signal_engine.py:381-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) tools/gateway_minute_restart_probe.py:128 — tools/gateway_minute_restart_probe.py:128-148 | tools/gateway_ten_job_restart_probe.py:306-326 — 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 (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 (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) REDACTED:115 — REDACTED:115-133 | agent/src/channels/telegram.py:206-224 — 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 (19 lines × 2) 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 — 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 (13 lines × 2) · ×2
  • 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 (11 lines × 3) · ×2
  • Duplicated block (11 lines × 3) agent/backtest/loaders/akshare_loader.py:158 — agent/backtest/loaders/akshare_loader.py:158-168 | agent/backtest/loaders/eastmoney_loader.py:109-121 | agent/backtest/loaders/mootdx_loader.py:146-156 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) agent/src/factors/zoo/gtja191/alpha_049.py:49 — agent/src/factors/zoo/gtja191/alpha_049.py:49-59 | agent/src/factors/zoo/gtja191/alpha_050.py:49-59 | agent/src/factors/zoo/gtja191/alpha_051.py:49-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.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) agent/cli/_legacy.py:5128 — agent/cli/_legacy.py:5128-5136 | agent/cli/_legacy.py:5199-5208 — both copies are in the same file, so extract the 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:90-98 | 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 (8 lines × 10) · ×2
  • Duplicated block (8 lines × 10) 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 — 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. 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 × 10) 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 — 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. 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 × 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:257 — agent/src/tools/fred_macro_tool.py:257-262 | agent/src/tools/research_reports_tool.py:231-236 | agent/src/tools/sec_filings_tool.py:179-184 | agent/src/tools/symbol_search_tool.py:429-434 — 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:308 — frontend/src/lib/swarmStatus.ts:308 · frontend/src/lib/swarmStatus.ts:328 · frontend/src/lib/swarmStatus.ts:347 — 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:509 — frontend/src/pages/Settings.tsx:509 · frontend/src/pages/Settings.tsx:659 · frontend/src/pages/Settings.tsx:694 — 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 (14 lines × 2 locations) · ×2
  • 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.
R10 · Code Duplication · Duplicated block (12 lines × 3 locations) · ×2
  • Duplicated block (12 lines × 3 locations) frontend/src/pages/Settings.tsx:526 — frontend/src/pages/Settings.tsx:526 · frontend/src/pages/Settings.tsx:678 · frontend/src/pages/Settings.tsx:713 — 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:550 — frontend/src/pages/Settings.tsx:550 · frontend/src/pages/Settings.tsx:563 · frontend/src/pages/Settings.tsx:576 — 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.
D1 · Cyclomatic Complexity · Agent.Agent (cyclomatic 364) · ×1
  • Agent.Agent (cyclomatic 364) frontend/src/pages/Agent.tsx:227 — Agent.Agent has cyclomatic complexity 364 (threshold 15). Of this number, 22 points are the body's own statements and 342 belong to 74 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 92) · ×1
  • AgentLoop._run_bound (cyclomatic 92) REDACTED:386 — AgentLoop._run_bound has cyclomatic complexity 92 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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 · ResearchLab.ResearchLab (cyclomatic 69) · ×1
  • ResearchLab.ResearchLab (cyclomatic 69) frontend/src/pages/ResearchLab.tsx:20 — ResearchLab.ResearchLab has cyclomatic complexity 69 (threshold 15). Of this number, 22 points are the body's own statements and 47 belong to 16 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 · 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 · ShannonPortfolio.ShannonPortfolio (cyclomatic 66) · ×1
  • ShannonPortfolio.ShannonPortfolio (cyclomatic 66) frontend/src/components/charts/ShannonPortfolio.tsx:31 — ShannonPortfolio.ShannonPortfolio has cyclomatic complexity 66 (threshold 15). Of this number, 30 points are the body's own statements and 36 belong to 11 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 63) · ×1
  • _legacy.main (cyclomatic 63) agent/cli/_legacy.py:6402 — _legacy.main has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ResearchArtifacts.ResearchArtifacts (cyclomatic 63) · ×1
  • ResearchArtifacts.ResearchArtifacts (cyclomatic 63) frontend/src/pages/ResearchArtifacts.tsx:80 — ResearchArtifacts.ResearchArtifacts has cyclomatic complexity 63 (threshold 15). Of this number, 26 points are the body's own statements and 37 belong to 8 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 · options_portfolio._calc_options_metrics (cyclomatic 58) · ×1
  • options_portfolio._calc_options_metrics (cyclomatic 58) agent/backtest/engines/options_portfolio.py:705 — 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 · ToolCallLifecycle._process_tool_calls (cyclomatic 57) · ×1
  • ToolCallLifecycle._process_tool_calls (cyclomatic 57) agent/src/agent/tool_lifecycle.py:95 — ToolCallLifecycle._process_tool_calls has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · historical._walk_bars (cyclomatic 55) · ×1
  • historical._walk_bars (cyclomatic 55) agent/src/data_gateway/historical.py:121 — historical._walk_bars has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PortfolioService._collect_source (cyclomatic 53) · ×1
  • PortfolioService._collect_source (cyclomatic 53) agent/src/portfolio/service.py:962 — 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 52) · ×1
  • options_portfolio.run_options_backtest (cyclomatic 52) agent/backtest/engines/options_portfolio.py:199 — options_portfolio.run_options_backtest has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worker._run_worker_impl (cyclomatic 52) · ×1
  • worker._run_worker_impl (cyclomatic 52) agent/src/swarm/worker.py:557 — worker._run_worker_impl has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OptionsLab.OptionsLab (cyclomatic 50) · ×1
  • OptionsLab.OptionsLab (cyclomatic 50) frontend/src/pages/OptionsLab.tsx:61 — OptionsLab.OptionsLab has cyclomatic complexity 50 (threshold 15). Of this number, 37 points are the body's own statements and 13 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 · _PolicyMixin._derivation (cyclomatic 49) · ×1
  • _PolicyMixin._derivation (cyclomatic 49) agent/evals/grounding/policies.py:1957 — _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 · ChatLLM.stream_chat (cyclomatic 49) · ×1
  • ChatLLM.stream_chat (cyclomatic 49) agent/src/providers/chat.py:495 — ChatLLM.stream_chat 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:1290 — 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 · schema._validate_expectations (cyclomatic 47) · ×1
  • schema._validate_expectations (cyclomatic 47) agent/evals/harness/schema.py:79 — schema._validate_expectations 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 · HistoryStore.run (cyclomatic 47) · ×1
  • HistoryStore.run (cyclomatic 47) agent/src/data_gateway/history_store.py:526 — HistoryStore.run 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 · bench_runner_strict.run_bench_strict (cyclomatic 46) · ×1
  • bench_runner_strict.run_bench_strict (cyclomatic 46) agent/src/factors/bench_runner_strict.py:326 — bench_runner_strict.run_bench_strict has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · swarmStatus.applySwarmEvent (cyclomatic 46) · ×1
  • swarmStatus.applySwarmEvent (cyclomatic 46) frontend/src/lib/swarmStatus.ts:209 — swarmStatus.applySwarmEvent has cyclomatic complexity 46 (threshold 15). Of this number, 27 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 · _PolicyMixin._referenced (cyclomatic 45) · ×1
  • _PolicyMixin._referenced (cyclomatic 45) agent/evals/grounding/policies.py:817 — _PolicyMixin._referenced has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 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 · runner.fetch_data_map (cyclomatic 44) · ×1
  • runner.fetch_data_map (cyclomatic 44) agent/backtest/runner.py:2060 — runner.fetch_data_map 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 · figures.scan_figures (cyclomatic 44) · ×1
  • figures.scan_figures (cyclomatic 44) agent/evals/grounding/figures.py:1254 — 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 · ConnectionCenter.ConnectionCard (cyclomatic 44) · ×1
  • ConnectionCenter.ConnectionCard (cyclomatic 44) frontend/src/components/portfolio/ConnectionCenter.tsx:183 — ConnectionCenter.ConnectionCard has cyclomatic complexity 44 (threshold 15). Of this number, 31 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 · 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 · _PolicyMixin._validate_figures (cyclomatic 43) · ×1
  • _PolicyMixin._validate_figures (cyclomatic 43) agent/evals/grounding/policies.py:467 — _PolicyMixin._validate_figures 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 · _PolicyMixin._check_observed (cyclomatic 43) · ×1
  • _PolicyMixin._check_observed (cyclomatic 43) agent/evals/grounding/policies.py:1695 — _PolicyMixin._check_observed 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 · 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 · IdentityLedger._ingest_resolution (cyclomatic 41) · ×1
  • IdentityLedger._ingest_resolution (cyclomatic 41) agent/src/agent/instrument_identity.py:739 — IdentityLedger._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 · financial_facts.validate_financial_facts (cyclomatic 41) · ×1
  • financial_facts.validate_financial_facts (cyclomatic 41) agent/src/research_artifacts/financial_facts.py:69 — financial_facts.validate_financial_facts 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 · Settings.Settings (cyclomatic 41) · ×1
  • Settings.Settings (cyclomatic 41) frontend/src/pages/Settings.tsx:42 — Settings.Settings has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. 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 · llm.build_llm (cyclomatic 40) · ×1
  • llm.build_llm (cyclomatic 40) agent/src/providers/llm.py:1454 — llm.build_llm has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 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 · 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 · gildata_fin_query_tool._normalize_table (cyclomatic 39) · ×1
  • gildata_fin_query_tool._normalize_table (cyclomatic 39) agent/src/tools/gildata_fin_query_tool.py:35 — gildata_fin_query_tool._normalize_table 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 · MarketDataTool.execute (cyclomatic 39) · ×1
  • MarketDataTool.execute (cyclomatic 39) agent/src/tools/market_data_tool.py:172 — MarketDataTool.execute 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:175 — 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 · sources.normalize (cyclomatic 37) · ×1
  • sources.normalize (cyclomatic 37) agent/src/data_gateway/sources.py:25 — sources.normalize 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 · historical.fetch_bars (cyclomatic 36) · ×1
  • historical.fetch_bars (cyclomatic 36) agent/src/data_gateway/historical.py:21 — historical.fetch_bars 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 · session_5m.match_orders_5m (cyclomatic 36) · ×1
  • session_5m.match_orders_5m (cyclomatic 36) agent/src/tools/paper_trade/session_5m.py:141 — session_5m.match_orders_5m 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 · tool._execute_step (cyclomatic 36) · ×1
  • tool._execute_step (cyclomatic 36) agent/src/tools/paper_trade/tool.py:229 — tool._execute_step 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:573 — 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 · BaseEngine.run_backtest (cyclomatic 34) · ×1
  • BaseEngine.run_backtest (cyclomatic 34) agent/backtest/engines/base.py:981 — BaseEngine.run_backtest has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatLLM._parse_response (cyclomatic 34) · ×1
  • ChatLLM._parse_response (cyclomatic 34) agent/src/providers/chat.py:677 — ChatLLM._parse_response 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:1270 — 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 · data_refs.resolve_data_refs (cyclomatic 33) · ×1
  • data_refs.resolve_data_refs (cyclomatic 33) agent/src/tools/data_refs.py:12 — data_refs.resolve_data_refs 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 · SymbolSearchTool.execute (cyclomatic 33) · ×1
  • SymbolSearchTool.execute (cyclomatic 33) agent/src/tools/symbol_search_tool.py:263 — SymbolSearchTool.execute has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 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 · HistoryStorageSettings.HistoryStorageSettings (cyclomatic 33) · ×1
  • HistoryStorageSettings.HistoryStorageSettings (cyclomatic 33) frontend/src/components/settings/HistoryStorageSettings.tsx:9 — HistoryStorageSettings.HistoryStorageSettings has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 9 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 53, a function literal at line 130, act, …). 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 · 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:1428 — 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:98 — 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 175, handleResolve, a function literal at line 161, …). 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 · options.buildPayoffRequest (cyclomatic 32) · ×1
  • options.buildPayoffRequest (cyclomatic 32) frontend/src/lib/options.ts:373 — options.buildPayoffRequest has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · metrics.calc_metrics (cyclomatic 31) · ×1
  • metrics.calc_metrics (cyclomatic 31) agent/backtest/metrics.py:606 — 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:1303 — 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:323 — 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 · 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:1799 — 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:1559 — 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:4847 — _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 · _EvidenceMixin._ingest_engine_table (cyclomatic 29) · ×1
  • _EvidenceMixin._ingest_engine_table (cyclomatic 29) agent/evals/grounding/evidence.py:1199 — _EvidenceMixin._ingest_engine_table 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 · measurements.measurement_verdicts (cyclomatic 29) · ×1
  • measurements.measurement_verdicts (cyclomatic 29) agent/evals/harness/measurements.py:55 — measurements.measurement_verdicts 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 66, a function literal at line 72, …). 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:4108 — _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:4941 — _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 · assertions._budget_verdicts (cyclomatic 28) · ×1
  • assertions._budget_verdicts (cyclomatic 28) agent/evals/harness/assertions.py:535 — assertions._budget_verdicts 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 · history_router.fetch_chunk (cyclomatic 28) · ×1
  • history_router.fetch_chunk (cyclomatic 28) agent/src/data_gateway/history_router.py:296 — history_router.fetch_chunk 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:892 — 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:1491 — 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 · ConnectionCenter.ConnectionCenter (cyclomatic 28) · ×1
  • ConnectionCenter.ConnectionCenter (cyclomatic 28) frontend/src/components/portfolio/ConnectionCenter.tsx:21 — ConnectionCenter.ConnectionCenter has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 8 function items inside it that branch (create, test, remove, …). 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.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 · _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/evals/grounding/ledger.py:121 — 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/evals/grounding/policies.py:1059 — _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 · ToolCallLifecycle._finalize_tool_result (cyclomatic 27) · ×1
  • ToolCallLifecycle._finalize_tool_result (cyclomatic 27) agent/src/agent/tool_lifecycle.py:938 — ToolCallLifecycle._finalize_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 · attribution_core._build_attribution_payload (cyclomatic 27) · ×1
  • attribution_core._build_attribution_payload (cyclomatic 27) agent/src/api/attribution_core.py:776 — attribution_core._build_attribution_payload 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 · 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:195 — 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:4463 — _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:5327 — _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 · 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 · history_router._normalize (cyclomatic 26) · ×1
  • history_router._normalize (cyclomatic 26) agent/src/data_gateway/history_router.py:222 — history_router._normalize 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 · PortfolioService.refresh (cyclomatic 26) · ×1
  • PortfolioService.refresh (cyclomatic 26) agent/src/portfolio/service.py:303 — 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:2000 — 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 · 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:741 — 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:313 — 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:4376 — _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/evals/grounding/figures.py:483 — 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 · 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 · history_router.plan (cyclomatic 25) · ×1
  • history_router.plan (cyclomatic 25) agent/src/data_gateway/history_router.py:113 — history_router.plan 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 · 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 · api.errorFromResponse (cyclomatic 25) · ×1
  • api.errorFromResponse (cyclomatic 25) frontend/src/lib/api.ts:403 — api.errorFromResponse has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 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 · Correlation.CorrelationAnalysis (cyclomatic 25) · ×1
  • Correlation.CorrelationAnalysis (cyclomatic 25) frontend/src/pages/Correlation.tsx:44 — Correlation.CorrelationAnalysis 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:521 — 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:1944 — 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 · validation.walk_forward_analysis (cyclomatic 24) · ×1
  • validation.walk_forward_analysis (cyclomatic 24) agent/backtest/validation.py:246 — validation.walk_forward_analysis 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 · assertions._identity_verdicts (cyclomatic 24) · ×1
  • assertions._identity_verdicts (cyclomatic 24) agent/evals/harness/assertions.py:349 — assertions._identity_verdicts 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 · MarketDataGateway._fetch (cyclomatic 24) · ×1
  • MarketDataGateway._fetch (cyclomatic 24) agent/src/data_gateway/service.py:185 — MarketDataGateway._fetch 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 · discovery._list_openai_codex_models (cyclomatic 24) · ×1
  • discovery._list_openai_codex_models (cyclomatic 24) agent/src/providers/discovery.py:119 — discovery._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 · 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 · evidence_handoff._observations (cyclomatic 24) · ×1
  • evidence_handoff._observations (cyclomatic 24) agent/src/swarm/evidence_handoff.py:14 — evidence_handoff._observations 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 · SwarmRuntime._apply_resume_overlay (cyclomatic 24) · ×1
  • SwarmRuntime._apply_resume_overlay (cyclomatic 24) agent/src/swarm/runtime.py:783 — SwarmRuntime._apply_resume_overlay 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:348 — 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 · SwarmStatusCard.SwarmStatusCard (cyclomatic 24) · ×1
  • SwarmStatusCard.SwarmStatusCard (cyclomatic 24) frontend/src/components/chat/SwarmStatusCard.tsx:182 — SwarmStatusCard.SwarmStatusCard has cyclomatic complexity 24 (threshold 15). Of this number, 14 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 · 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 · VolatilitySurfaceGrid.VolatilitySurfaceGrid (cyclomatic 24) · ×1
  • VolatilitySurfaceGrid.VolatilitySurfaceGrid (cyclomatic 24) frontend/src/components/options/VolatilitySurfaceGrid.tsx:25 — VolatilitySurfaceGrid.VolatilitySurfaceGrid has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 4 function items inside it that branch (compute, cellStyle, a function literal at line 46, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
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:687 — 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 · runner._select_market_engine (cyclomatic 23) · ×1
  • runner._select_market_engine (cyclomatic 23) agent/backtest/runner.py:1786 — runner._select_market_engine 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 · _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:2166 — _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:2609 — _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 · figures.parse_figures_block (cyclomatic 23) · ×1
  • figures.parse_figures_block (cyclomatic 23) agent/evals/grounding/figures.py:821 — figures.parse_figures_block 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 · instrument_identity._infer_instrument_type (cyclomatic 23) · ×1
  • instrument_identity._infer_instrument_type (cyclomatic 23) agent/src/agent/instrument_identity.py:345 — instrument_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 · result_artifacts.deliver_tool_result (cyclomatic 23) · ×1
  • result_artifacts.deliver_tool_result (cyclomatic 23) agent/src/agent/result_artifacts.py:136 — result_artifacts.deliver_tool_result 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 · 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 · market_data._fetch_market_data_direct (cyclomatic 23) · ×1
  • market_data._fetch_market_data_direct (cyclomatic 23) agent/src/market_data.py:220 — market_data._fetch_market_data_direct 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 · PredictionMarketTool.execute (cyclomatic 23) · ×1
  • PredictionMarketTool.execute (cyclomatic 23) agent/src/tools/prediction_market_tool.py:1120 — 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 · SwarmTool.execute (cyclomatic 23) · ×1
  • SwarmTool.execute (cyclomatic 23) agent/src/tools/swarm_tool.py:540 — SwarmTool.execute 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 · 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 · SoftwareUpdateSettings.SoftwareUpdateSettings (cyclomatic 23) · ×1
  • SoftwareUpdateSettings.SoftwareUpdateSettings (cyclomatic 23) frontend/src/components/settings/SoftwareUpdateSettings.tsx:5 — SoftwareUpdateSettings.SoftwareUpdateSettings has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · yahoo_client._parse_chart (cyclomatic 22) · ×1
  • yahoo_client._parse_chart (cyclomatic 22) agent/backtest/loaders/yahoo_client.py:221 — 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 · _EvidenceMixin._record_backtest_metrics (cyclomatic 22) · ×1
  • _EvidenceMixin._record_backtest_metrics (cyclomatic 22) agent/evals/grounding/evidence.py:999 — _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/evals/grounding/evidence.py:1360 — _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 · evidence._wrapped_percent_headers (cyclomatic 22) · ×1
  • evidence._wrapped_percent_headers (cyclomatic 22) agent/evals/grounding/evidence.py:752 — evidence._wrapped_percent_headers 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/evals/grounding/policies.py:1225 — _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 · 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 · instrument_identity._normalize_symbol (cyclomatic 22) · ×1
  • instrument_identity._normalize_symbol (cyclomatic 22) agent/src/agent/instrument_identity.py:165 — instrument_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 · 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 · ScanQueue._run (cyclomatic 22) · ×1
  • ScanQueue._run (cyclomatic 22) agent/src/data_gateway/scans.py:110 — ScanQueue._run 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 · 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:1202 — 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:684 — 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:140 — 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:128 — 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:1208 — 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 · OptionsChainTool.execute (cyclomatic 22) · ×1
  • OptionsChainTool.execute (cyclomatic 22) agent/src/tools/options_chain_tool.py:71 — OptionsChainTool.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 · 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 · reconcile.reconcile_document (cyclomatic 22) · ×1
  • reconcile.reconcile_document (cyclomatic 22) agent/src/tools/paper_trade/reconcile.py:149 — reconcile.reconcile_document 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 · research_papers_tool._arxiv_paper (cyclomatic 22) · ×1
  • research_papers_tool._arxiv_paper (cyclomatic 22) agent/src/tools/research_papers_tool.py:1017 — 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:883 — 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 · runner.main (cyclomatic 21) · ×1
  • runner.main (cyclomatic 21) agent/backtest/runner.py:1461 — runner.main has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _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:1953 — _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:6253 — _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 · evidence._document_percent_cells (cyclomatic 21) · ×1
  • evidence._document_percent_cells (cyclomatic 21) agent/evals/grounding/evidence.py:814 — evidence._document_percent_cells 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 · 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 · history_source.fetch_chunk (cyclomatic 21) · ×1
  • history_source.fetch_chunk (cyclomatic 21) agent/src/data_gateway/history_source.py:69 — history_source.fetch_chunk 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 · checkpoint.restore (cyclomatic 21) · ×1
  • checkpoint.restore (cyclomatic 21) agent/src/swarm/checkpoint.py:40 — checkpoint.restore 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 · EtfHoldingsTool.execute (cyclomatic 21) · ×1
  • EtfHoldingsTool.execute (cyclomatic 21) agent/src/tools/etf_holdings_tool.py:1808 — 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:1432 — 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 · OptionsPayoffTool._execute_single (cyclomatic 21) · ×1
  • OptionsPayoffTool._execute_single (cyclomatic 21) agent/src/tools/options_payoff_tool.py:203 — OptionsPayoffTool._execute_single 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 · 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:237 — 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 · composite._build_rule_engines (cyclomatic 20) · ×1
  • composite._build_rule_engines (cyclomatic 20) agent/backtest/engines/composite.py:29 — composite._build_rule_engines 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 · DataLoader._fetch_one (cyclomatic 20) · ×1
  • DataLoader._fetch_one (cyclomatic 20) REDACTED:241 — DataLoader._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 · _SwarmDashboard.build_table (cyclomatic 20) · ×1
  • _SwarmDashboard.build_table (cyclomatic 20) agent/cli/_legacy.py:2237 — _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 · _EvidenceMixin._ingest_analysis_result (cyclomatic 20) · ×1
  • _EvidenceMixin._ingest_analysis_result (cyclomatic 20) agent/evals/grounding/evidence.py:873 — _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 · mcp_server.alpha_bench (cyclomatic 20) · ×1
  • mcp_server.alpha_bench (cyclomatic 20) agent/mcp_server.py:1059 — 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 · 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 · historical.describe_coverage (cyclomatic 20) · ×1
  • historical.describe_coverage (cyclomatic 20) agent/src/data_gateway/historical.py:374 — historical.describe_coverage 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:1203 — 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:377 — 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._query_claude_cli_models (cyclomatic 20) · ×1
  • claude_cli._query_claude_cli_models (cyclomatic 20) agent/src/providers/claude_cli.py:733 — claude_cli._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 · volatility.implied_volatility_surface (cyclomatic 20) · ×1
  • volatility.implied_volatility_surface (cyclomatic 20) agent/src/quantlib/volatility.py:279 — volatility.implied_volatility_surface 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_layer (cyclomatic 20) · ×1
  • SwarmRuntime._execute_layer (cyclomatic 20) agent/src/swarm/runtime.py:992 — SwarmRuntime._execute_layer 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:223 — 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:175 — 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 · update-verification.verifyWindowsUpdateCandidate (cyclomatic 20) · ×1
  • update-verification.verifyWindowsUpdateCandidate (cyclomatic 20) desktop/electron/src/update-verification.ts:53 — update-verification.verifyWindowsUpdateCandidate 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 · options.buildVolatilitySurfaceRequest (cyclomatic 20) · ×1
  • options.buildVolatilitySurfaceRequest (cyclomatic 20) frontend/src/lib/options.ts:258 — options.buildVolatilitySurfaceRequest 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 · 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 · DataLoader._request_page (cyclomatic 19) · ×1
  • DataLoader._request_page (cyclomatic 19) REDACTED:158 — 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:2719 — _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 · _EvidenceMixin._record_backtest_outputs (cyclomatic 19) · ×1
  • _EvidenceMixin._record_backtest_outputs (cyclomatic 19) agent/evals/grounding/evidence.py:1069 — _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/evals/grounding/evidence.py:1660 — _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/evals/grounding/policies.py:2132 — _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 · assertions._tool_result_join_verdict (cyclomatic 19) · ×1
  • assertions._tool_result_join_verdict (cyclomatic 19) agent/evals/harness/assertions.py:735 — 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 · measurements.validate_measurements (cyclomatic 19) · ×1
  • measurements.validate_measurements (cyclomatic 19) agent/evals/harness/measurements.py:16 — measurements.validate_measurements 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 · 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 · bar_summary.summarize_bars (cyclomatic 19) · ×1
  • bar_summary.summarize_bars (cyclomatic 19) agent/src/data_gateway/bar_summary.py:7 — bar_summary.summarize_bars 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 · fanout.acquire_groups (cyclomatic 19) · ×1
  • fanout.acquire_groups (cyclomatic 19) agent/src/data_gateway/fanout.py:20 — fanout.acquire_groups 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 · reads.read (cyclomatic 19) · ×1
  • reads.read (cyclomatic 19) agent/src/data_gateway/reads.py:50 — reads.read 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:899 — 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 · SwarmRuntime._execute_run (cyclomatic 19) · ×1
  • SwarmRuntime._execute_run (cyclomatic 19) agent/src/swarm/runtime.py:520 — SwarmRuntime._execute_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 · FredMacroTool.execute (cyclomatic 19) · ×1
  • FredMacroTool.execute (cyclomatic 19) agent/src/tools/fred_macro_tool.py:116 — 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:727 — 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 · 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 · main.installUpdate (cyclomatic 19) · ×1
  • main.installUpdate (cyclomatic 19) desktop/electron/src/main.ts:305 — main.installUpdate 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:261 — 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 · shannon.parseHoldings (cyclomatic 19) · ×1
  • shannon.parseHoldings (cyclomatic 19) frontend/src/lib/shannon.ts:37 — shannon.parseHoldings 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 · 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:237 — 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:469 — 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:585 — 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 · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) · ×1
  • _EvidenceMixin._ingest_run_dir_ohlc_csvs (cyclomatic 18) agent/evals/grounding/evidence.py:1552 — _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/evals/grounding/figures.py:939 — 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/evals/grounding/figures.py:1051 — 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 · 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 · 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 · calendars.validate (cyclomatic 18) · ×1
  • calendars.validate (cyclomatic 18) agent/src/data_gateway/calendars.py:40 — calendars.validate 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:118 — 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:2160 — 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) agent/src/trading/connectors/mt5/_client.py: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 · options.volatilitySurfaceIssue (cyclomatic 18) · ×1
  • options.volatilitySurfaceIssue (cyclomatic 18) frontend/src/lib/options.ts:292 — options.volatilitySurfaceIssue 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 · 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:150 — 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:77 — 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:1340 — 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 · _legacy._handle_swarm_command (cyclomatic 17) · ×1
  • _legacy._handle_swarm_command (cyclomatic 17) agent/cli/_legacy.py:2012 — _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 · FiguresBlock.match (cyclomatic 17) · ×1
  • FiguresBlock.match (cyclomatic 17) agent/evals/grounding/figures.py:180 — FiguresBlock.match 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/evals/grounding/policies.py:2664 — 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 · assertions._evidence_verdicts (cyclomatic 17) · ×1
  • assertions._evidence_verdicts (cyclomatic 17) agent/evals/harness/assertions.py:456 — assertions._evidence_verdicts 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 · settings_routes._build_llm_settings_response (cyclomatic 17) · ×1
  • settings_routes._build_llm_settings_response (cyclomatic 17) agent/src/api/settings_routes.py:203 — 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 · settings.get_llm_credentials (cyclomatic 17) · ×1
  • settings.get_llm_credentials (cyclomatic 17) agent/src/providers/settings.py:173 — settings.get_llm_credentials 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 · execution.freeze_run (cyclomatic 17) · ×1
  • execution.freeze_run (cyclomatic 17) agent/src/research_lab/execution.py:62 — execution.freeze_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 · 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 · BackgroundManager._execute (cyclomatic 17) · ×1
  • BackgroundManager._execute (cyclomatic 17) agent/src/tools/background_tools.py:296 — 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:333 — 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:722 — 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:184 — 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:187 — 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 · 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:82 — 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 · StrategyBuilder.StrategyBuilder (cyclomatic 17) · ×1
  • StrategyBuilder.StrategyBuilder (cyclomatic 17) frontend/src/components/options/StrategyBuilder.tsx:25 — StrategyBuilder.StrategyBuilder has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 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 · metrics.win_rate_and_stats (cyclomatic 16) · ×1
  • metrics.win_rate_and_stats (cyclomatic 16) agent/backtest/metrics.py:386 — 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:205 — 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.bootstrap_sharpe_ci (cyclomatic 16) · ×1
  • validation.bootstrap_sharpe_ci (cyclomatic 16) agent/backtest/validation.py:152 — validation.bootstrap_sharpe_ci 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 · _legacy._show_settings (cyclomatic 16) · ×1
  • _legacy._show_settings (cyclomatic 16) agent/cli/_legacy.py:1894 — _legacy._show_settings 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 · main._render_mandate_proposal (cyclomatic 16) · ×1
  • main._render_mandate_proposal (cyclomatic 16) agent/cli/main.py:1008 — 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 · evidence._metric_kind_for_path (cyclomatic 16) · ×1
  • evidence._metric_kind_for_path (cyclomatic 16) agent/evals/grounding/evidence.py:618 — 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/evals/grounding/figures.py:610 — 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 · _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) · ×1
  • _PolicyMixin._unknown_call_field_ref_candidates (cyclomatic 16) agent/evals/grounding/policies.py:1362 — _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 · assertions._tool_verdicts (cyclomatic 16) · ×1
  • assertions._tool_verdicts (cyclomatic 16) agent/evals/harness/assertions.py:261 — 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 · 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 · __main__.run_history (cyclomatic 16) · ×1
  • __main__.run_history (cyclomatic 16) agent/src/data_gateway/__main__.py:28 — __main__.run_history 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 · HistoryStore.start (cyclomatic 16) · ×1
  • HistoryStore.start (cyclomatic 16) agent/src/data_gateway/history_store.py:439 — HistoryStore.start 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 · sources.cboe_options (cyclomatic 16) · ×1
  • sources.cboe_options (cyclomatic 16) agent/src/data_gateway/sources.py:131 — sources.cboe_options 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 · Topic.parse (cyclomatic 16) · ×1
  • Topic.parse (cyclomatic 16) agent/src/data_gateway/streams.py:34 — Topic.parse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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:566 — 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 · discovery._list_provider_models (cyclomatic 16) · ×1
  • discovery._list_provider_models (cyclomatic 16) agent/src/providers/discovery.py:201 — discovery._list_provider_models 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._build_anthropic (cyclomatic 16) · ×1
  • llm._build_anthropic (cyclomatic 16) agent/src/providers/llm.py:1232 — llm._build_anthropic 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 · 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 · financial_statements_tool._synthesize_fiscal_q4 (cyclomatic 16) · ×1
  • financial_statements_tool._synthesize_fiscal_q4 (cyclomatic 16) agent/src/tools/financial_statements_tool.py:576 — 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 · HistoryDataTool.execute (cyclomatic 16) · ×1
  • HistoryDataTool.execute (cyclomatic 16) agent/src/tools/history_data_tool.py:100 — HistoryDataTool.execute 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_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 · ResearchLabTool.execute (cyclomatic 16) · ×1
  • ResearchLabTool.execute (cyclomatic 16) agent/src/tools/research_lab_tool.py:36 — ResearchLabTool.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 · research_papers_tool._arxiv_search (cyclomatic 16) · ×1
  • research_papers_tool._arxiv_search (cyclomatic 16) agent/src/tools/research_papers_tool.py:1110 — 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:1316 — 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:1525 — 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:124 — 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 · 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 418) · ×1
  • Agent.Agent (cognitive 418) frontend/src/pages/Agent.tsx:227 — Agent.Agent has cognitive complexity 418 (threshold 15). Drivers by points: if/else 156 (191 pts), boolean chains 120, ternaries 49 (90 pts), error handling 7 (9 pts), loops 8 (nesting depth added 78). Of this number, 18 points are the body's own statements and 400 belong to 74 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 169) · ×1
  • AgentLoop._run_bound (cognitive 169) REDACTED:386 — AgentLoop._run_bound has cognitive complexity 169 (threshold 15). Drivers by points: if/else 49 (109 pts), boolean chains 31, ternaries 10 (21 pts), error handling 3 (7 pts), loops 1 (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options_portfolio.run_options_backtest (cognitive 151) · ×1
  • options_portfolio.run_options_backtest (cognitive 151) agent/backtest/engines/options_portfolio.py:199 — options_portfolio.run_options_backtest has cognitive complexity 151 (threshold 15). Drivers by points: if/else 29 (87 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 · historical._walk_bars (cognitive 114) · ×1
  • historical._walk_bars (cognitive 114) agent/src/data_gateway/historical.py:121 — historical._walk_bars has cognitive complexity 114 (threshold 15). Drivers by points: if/else 17 (42 pts), ternaries 11 (27 pts), boolean chains 16, loops 7 (16 pts), error handling 5 (13 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · ToolCallLifecycle._process_tool_calls (cognitive 109) · ×1
  • ToolCallLifecycle._process_tool_calls (cognitive 109) agent/src/agent/tool_lifecycle.py:95 — ToolCallLifecycle._process_tool_calls has cognitive complexity 109 (threshold 15). Drivers by points: if/else 28 (64 pts), ternaries 7 (16 pts), boolean chains 15, loops 8 (14 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine._execute_bars (cognitive 106) · ×1
  • BaseEngine._execute_bars (cognitive 106) agent/backtest/engines/base.py:1290 — 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 · session_5m.match_orders_5m (cognitive 98) · ×1
  • session_5m.match_orders_5m (cognitive 98) agent/src/tools/paper_trade/session_5m.py:141 — session_5m.match_orders_5m has cognitive complexity 98 (threshold 15). Drivers by points: if/else 25 (71 pts), loops 8 (15 pts), ternaries 2 (8 pts), boolean chains 4 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch 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 95) · ×1
  • runner.fetch_data_map (cognitive 95) agent/backtest/runner.py:2060 — runner.fetch_data_map has cognitive complexity 95 (threshold 15). Drivers by points: if/else 25 (62 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 · worker._run_worker_impl (cognitive 90) · ×1
  • worker._run_worker_impl (cognitive 90) agent/src/swarm/worker.py:557 — worker._run_worker_impl has cognitive complexity 90 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 19, ternaries 5 (13 pts), error handling 4 (6 pts), loops 2 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schema._validate_expectations (cognitive 84) · ×1
  • schema._validate_expectations (cognitive 84) agent/evals/harness/schema.py:79 — schema._validate_expectations has cognitive complexity 84 (threshold 15). Drivers by points: if/else 28 (59 pts), loops 6 (12 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:962 — 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 · HistoryStore.run (cognitive 82) · ×1
  • HistoryStore.run (cognitive 82) agent/src/data_gateway/history_store.py:526 — HistoryStore.run has cognitive complexity 82 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 14, ternaries 7 (13 pts), loops 3 (5 pts), error handling 2 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _legacy.main (cognitive 80) · ×1
  • _legacy.main (cognitive 80) agent/cli/_legacy.py:6402 — _legacy.main has cognitive complexity 80 (threshold 15). Drivers by points: if/else 56 (68 pts), ternaries 3 (7 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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._validate_figures (cognitive 77) · ×1
  • _PolicyMixin._validate_figures (cognitive 77) agent/evals/grounding/policies.py:467 — _PolicyMixin._validate_figures has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (46 pts), ternaries 5 (14 pts), boolean chains 12, loops 3 (5 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatLLM.stream_chat (cognitive 77) · ×1
  • ChatLLM.stream_chat (cognitive 77) agent/src/providers/chat.py:495 — ChatLLM.stream_chat has cognitive complexity 77 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 18, ternaries 7 (14 pts), error handling 3, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · options_portfolio._calc_options_metrics (cognitive 76) · ×1
  • options_portfolio._calc_options_metrics (cognitive 76) agent/backtest/engines/options_portfolio.py:705 — 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 · gildata_fin_query_tool._normalize_table (cognitive 76) · ×1
  • gildata_fin_query_tool._normalize_table (cognitive 76) agent/src/tools/gildata_fin_query_tool.py:35 — gildata_fin_query_tool._normalize_table has cognitive complexity 76 (threshold 15). Drivers by points: if/else 15 (37 pts), ternaries 6 (22 pts), boolean chains 13, loops 3 (4 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · historical.fetch_bars (cognitive 75) · ×1
  • historical.fetch_bars (cognitive 75) agent/src/data_gateway/historical.py:21 — historical.fetch_bars has cognitive complexity 75 (threshold 15). Drivers by points: if/else 13 (38 pts), loops 9 (24 pts), boolean chains 8, ternaries 3, error handling 1 (2 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1303 — 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 · 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 · bench_runner_strict.run_bench_strict (cognitive 66) · ×1
  • bench_runner_strict.run_bench_strict (cognitive 66) agent/src/factors/bench_runner_strict.py:326 — bench_runner_strict.run_bench_strict has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (29 pts), ternaries 9 (14 pts), error handling 6 (10 pts), boolean chains 9, loops 4 (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 · 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 · _PolicyMixin._check_observed (cognitive 65) · ×1
  • _PolicyMixin._check_observed (cognitive 65) agent/evals/grounding/policies.py:1695 — _PolicyMixin._check_observed has cognitive complexity 65 (threshold 15). Drivers by points: if/else 28 (49 pts), boolean chains 8, ternaries 5 (8 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · measurements.measurement_verdicts (cognitive 65) · ×1
  • measurements.measurement_verdicts (cognitive 65) agent/evals/harness/measurements.py:55 — measurements.measurement_verdicts has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (46 pts), ternaries 3 (11 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (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 · financial_facts.validate_financial_facts (cognitive 65) · ×1
  • financial_facts.validate_financial_facts (cognitive 65) agent/src/research_artifacts/financial_facts.py:69 — financial_facts.validate_financial_facts has cognitive complexity 65 (threshold 15). Drivers by points: if/else 24 (46 pts), boolean chains 13, loops 4 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:175 — 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:1799 — 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/evals/grounding/figures.py:1254 — 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._referenced (cognitive 63) · ×1
  • _PolicyMixin._referenced (cognitive 63) agent/evals/grounding/policies.py:817 — _PolicyMixin._referenced has cognitive complexity 63 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 21, ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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/evals/grounding/policies.py:1957 — _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 · 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 · OptionsLab.OptionsLab (cognitive 61) · ×1
  • OptionsLab.OptionsLab (cognitive 61) frontend/src/pages/OptionsLab.tsx:61 — OptionsLab.OptionsLab has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 21 (37 pts), boolean chains 17, if/else 5 (6 pts), error handling 1 (nesting depth added 17). Of this number, 46 points are the body's own statements and 15 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 · ResearchArtifacts.ResearchArtifacts (cognitive 61) · ×1
  • ResearchArtifacts.ResearchArtifacts (cognitive 61) frontend/src/pages/ResearchArtifacts.tsx:80 — ResearchArtifacts.ResearchArtifacts has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 24, ternaries 12 (20 pts), if/else 9 (11 pts), error handling 6 (nesting depth added 10). Of this number, 16 points are the body's own statements and 45 belong to 8 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 · 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 · 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 · 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:4376 — _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 · ScanQueue._run (cognitive 55) · ×1
  • ScanQueue._run (cognitive 55) agent/src/data_gateway/scans.py:110 — ScanQueue._run has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 5 (12 pts), ternaries 2 (6 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sources.normalize (cognitive 55) · ×1
  • sources.normalize (cognitive 55) agent/src/data_gateway/sources.py:25 — sources.normalize has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 14, ternaries 6 (11 pts), loops 3 (6 pts), error handling 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · swarmStatus.applySwarmEvent (cognitive 53) · ×1
  • swarmStatus.applySwarmEvent (cognitive 53) frontend/src/lib/swarmStatus.ts:209 — swarmStatus.applySwarmEvent has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 18, ternaries 9 (18 pts), if/else 16 (17 pts) (nesting depth added 10). Of this number, 28 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 · 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 · IdentityLedger._ingest_resolution (cognitive 52) · ×1
  • IdentityLedger._ingest_resolution (cognitive 52) agent/src/agent/instrument_identity.py:739 — IdentityLedger._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:573 — 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 · 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 · ShannonPortfolio.ShannonPortfolio (cognitive 50) · ×1
  • ShannonPortfolio.ShannonPortfolio (cognitive 50) frontend/src/components/charts/ShannonPortfolio.tsx:31 — ShannonPortfolio.ShannonPortfolio has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 26, if/else 8 (11 pts), ternaries 8 (11 pts), error handling 2 (nesting depth added 6). Of this number, 28 points are the body's own statements and 22 belong to 11 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · _EvidenceMixin._ingest_engine_table (cognitive 49) · ×1
  • _EvidenceMixin._ingest_engine_table (cognitive 49) agent/evals/grounding/evidence.py:1199 — _EvidenceMixin._ingest_engine_table has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 5 (13 pts), boolean chains 7, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · ConnectionCenter.ConnectionCard (cognitive 49) · ×1
  • ConnectionCenter.ConnectionCard (cognitive 49) frontend/src/components/portfolio/ConnectionCenter.tsx:183 — ConnectionCenter.ConnectionCard has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 21 (31 pts), boolean chains 13, if/else 3, error handling 2 (nesting depth added 10). Of this number, 30 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 · runner._fetch_auto (cognitive 48) · ×1
  • runner._fetch_auto (cognitive 48) agent/backtest/runner.py:1944 — 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 · history_router.fetch_chunk (cognitive 48) · ×1
  • history_router.fetch_chunk (cognitive 48) agent/src/data_gateway/history_router.py:296 — history_router.fetch_chunk has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 10, ternaries 2 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · figures.parse_figures_block (cognitive 47) · ×1
  • figures.parse_figures_block (cognitive 47) agent/evals/grounding/figures.py:821 — figures.parse_figures_block has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 9 (23 pts), if/else 9 (18 pts), loops 2 (4 pts), boolean chains 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 · AgentLoop._auto_compact (cognitive 47) · ×1
  • AgentLoop._auto_compact (cognitive 47) REDACTED:1428 — 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 · evidence_handoff._observations (cognitive 47) · ×1
  • evidence_handoff._observations (cognitive 47) agent/src/swarm/evidence_handoff.py:14 — evidence_handoff._observations has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (29 pts), error handling 4 (11 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:606 — 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 · assertions._budget_verdicts (cognitive 45) · ×1
  • assertions._budget_verdicts (cognitive 45) agent/evals/harness/assertions.py:535 — assertions._budget_verdicts has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 7 (16 pts), boolean chains 7, 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 · PortfolioService.refresh (cognitive 45) · ×1
  • PortfolioService.refresh (cognitive 45) agent/src/portfolio/service.py:303 — 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 · ChatLLM._parse_response (cognitive 45) · ×1
  • ChatLLM._parse_response (cognitive 45) agent/src/providers/chat.py:677 — ChatLLM._parse_response has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 14, error handling 2 (6 pts), ternaries 6, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llm.build_llm (cognitive 45) · ×1
  • llm.build_llm (cognitive 45) agent/src/providers/llm.py:1454 — llm.build_llm has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 14, 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 · MarketDataTool.execute (cognitive 45) · ×1
  • MarketDataTool.execute (cognitive 45) agent/src/tools/market_data_tool.py:172 — MarketDataTool.execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 12, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · tool._execute_step (cognitive 45) · ×1
  • tool._execute_step (cognitive 45) agent/src/tools/paper_trade/tool.py:229 — tool._execute_step has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 10, 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 · 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:313 — 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 · 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 · 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 · 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 · history_router.plan (cognitive 42) · ×1
  • history_router.plan (cognitive 42) agent/src/data_gateway/history_router.py:113 — history_router.plan has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 6, ternaries 1 (4 pts), loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · market_data._fetch_market_data_direct (cognitive 42) · ×1
  • market_data._fetch_market_data_direct (cognitive 42) agent/src/market_data.py:220 — market_data._fetch_market_data_direct has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 4 (6 pts), ternaries 3 (6 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · 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 · MarketDataGateway._fetch (cognitive 41) · ×1
  • MarketDataGateway._fetch (cognitive 41) agent/src/data_gateway/service.py:185 — MarketDataGateway._fetch has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 3 (7 pts), boolean chains 5, error handling 2 (5 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmRuntime._apply_resume_overlay (cognitive 41) · ×1
  • SwarmRuntime._apply_resume_overlay (cognitive 41) agent/src/swarm/runtime.py:783 — SwarmRuntime._apply_resume_overlay has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 7 (11 pts), boolean chains 3, error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data_refs.resolve_data_refs (cognitive 41) · ×1
  • data_refs.resolve_data_refs (cognitive 41) agent/src/tools/data_refs.py:12 — data_refs.resolve_data_refs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 8, ternaries 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1491 — 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:684 — 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:4941 — _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 · bar_summary.summarize_bars (cognitive 40) · ×1
  • bar_summary.summarize_bars (cognitive 40) agent/src/data_gateway/bar_summary.py:7 — bar_summary.summarize_bars has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 5 (12 pts), boolean chains 4, error handling 1 (4 pts), loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · 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:2000 — 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:98 — 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 175, handleResolve, a function literal at line 161, …). 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 · BaseEngine.run_backtest (cognitive 39) · ×1
  • BaseEngine.run_backtest (cognitive 39) agent/backtest/engines/base.py:981 — BaseEngine.run_backtest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 8 (11 pts), boolean chains 5, 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 · DataLoader._fetch_one (cognitive 39) · ×1
  • DataLoader._fetch_one (cognitive 39) REDACTED:241 — DataLoader._fetch_one has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 2 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:521 — 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 · evidence._document_percent_cells (cognitive 39) · ×1
  • evidence._document_percent_cells (cognitive 39) agent/evals/grounding/evidence.py:814 — evidence._document_percent_cells has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 6, ternaries 3 (6 pts), loops 2 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _PolicyMixin._indexed_field_ref_candidates (cognitive 39) · ×1
  • _PolicyMixin._indexed_field_ref_candidates (cognitive 39) agent/evals/grounding/policies.py:1225 — _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 · ToolCallLifecycle._finalize_tool_result (cognitive 39) · ×1
  • ToolCallLifecycle._finalize_tool_result (cognitive 39) agent/src/agent/tool_lifecycle.py:938 — ToolCallLifecycle._finalize_tool_result has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 3 (7 pts), boolean chains 5, 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 · 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 · fanout.acquire_groups (cognitive 39) · ×1
  • fanout.acquire_groups (cognitive 39) agent/src/data_gateway/fanout.py:20 — fanout.acquire_groups has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (19 pts), error handling 3 (10 pts), loops 6 (8 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 · 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 · discovery._list_openai_codex_models (cognitive 39) · ×1
  • discovery._list_openai_codex_models (cognitive 39) agent/src/providers/discovery.py:119 — discovery._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 · 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:1270 — 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:892 — 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 · 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 · Settings.Settings (cognitive 39) · ×1
  • Settings.Settings (cognitive 39) frontend/src/pages/Settings.tsx:42 — Settings.Settings has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 39 (51 pts), boolean chains 30, if/else 26 (30 pts), 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 · runner._reject_forbidden_node (cognitive 38) · ×1
  • runner._reject_forbidden_node (cognitive 38) agent/backtest/runner.py:687 — 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:4847 — _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/evals/grounding/evidence.py:1360 — _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 · claude_cli._decide (cognitive 38) · ×1
  • claude_cli._decide (cognitive 38) agent/src/providers/claude_cli.py:377 — 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 · validation.walk_forward_analysis (cognitive 37) · ×1
  • validation.walk_forward_analysis (cognitive 37) agent/backtest/validation.py:246 — validation.walk_forward_analysis has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 6 (12 pts), boolean chains 5, 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 · _EvidenceMixin._ingest_run_dir_ohlc_csvs (cognitive 37) · ×1
  • _EvidenceMixin._ingest_run_dir_ohlc_csvs (cognitive 37) agent/evals/grounding/evidence.py:1552 — _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:1202 — 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 · reconcile.reconcile_document (cognitive 37) · ×1
  • reconcile.reconcile_document (cognitive 37) agent/src/tools/paper_trade/reconcile.py:149 — reconcile.reconcile_document has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 2 (5 pts), boolean chains 3, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SymbolSearchTool.execute (cognitive 37) · ×1
  • SymbolSearchTool.execute (cognitive 37) agent/src/tools/symbol_search_tool.py:263 — SymbolSearchTool.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 11, ternaries 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · instrument_identity._normalize_symbol (cognitive 36) · ×1
  • instrument_identity._normalize_symbol (cognitive 36) agent/src/agent/instrument_identity.py:165 — instrument_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 · volatility.implied_volatility_surface (cognitive 36) · ×1
  • volatility.implied_volatility_surface (cognitive 36) agent/src/quantlib/volatility.py:279 — volatility.implied_volatility_surface has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 5, loops 4 (5 pts), ternaries 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 · 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:1559 — 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:175 — 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:237 — 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/evals/grounding/evidence.py:999 — _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 · evidence._wrapped_percent_headers (cognitive 35) · ×1
  • evidence._wrapped_percent_headers (cognitive 35) agent/evals/grounding/evidence.py:752 — evidence._wrapped_percent_headers has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 10, loops 3 (5 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 · GroundingLedger.ingest_tool_result (cognitive 35) · ×1
  • GroundingLedger.ingest_tool_result (cognitive 35) agent/evals/grounding/ledger.py:121 — 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 · assertions._identity_verdicts (cognitive 35) · ×1
  • assertions._identity_verdicts (cognitive 35) agent/evals/harness/assertions.py:349 — assertions._identity_verdicts has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 9 (15 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 · 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 · SwarmRuntime._execute_layer (cognitive 35) · ×1
  • SwarmRuntime._execute_layer (cognitive 35) agent/src/swarm/runtime.py:992 — SwarmRuntime._execute_layer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 5 (8 pts), error handling 4 (7 pts), boolean chains 3, 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 · 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/evals/grounding/policies.py:1059 — _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 · 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 · history_router._normalize (cognitive 34) · ×1
  • history_router._normalize (cognitive 34) agent/src/data_gateway/history_router.py:222 — history_router._normalize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 9, ternaries 3 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · combination.combine_factors (cognitive 34) · ×1
  • combination.combine_factors (cognitive 34) agent/src/quantlib/combination.py:323 — 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 · OptionsChainTool.execute (cognitive 34) · ×1
  • OptionsChainTool.execute (cognitive 34) agent/src/tools/options_chain_tool.py:71 — OptionsChainTool.execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, loops 2 (5 pts), ternaries 2 (4 pts), 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 · SwarmTool.execute (cognitive 34) · ×1
  • SwarmTool.execute (cognitive 34) agent/src/tools/swarm_tool.py:540 — SwarmTool.execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 4 (5 pts), loops 2, ternaries 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 · 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:237 — 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:4108 — _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:4463 — _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 · result_artifacts.deliver_tool_result (cognitive 33) · ×1
  • result_artifacts.deliver_tool_result (cognitive 33) agent/src/agent/result_artifacts.py:136 — result_artifacts.deliver_tool_result has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (7 pts), error handling 3, ternaries 3, 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 · 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 · attribution_core._build_attribution_payload (cognitive 33) · ×1
  • attribution_core._build_attribution_payload (cognitive 33) agent/src/api/attribution_core.py:776 — attribution_core._build_attribution_payload has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 10, ternaries 3 (5 pts), error handling 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 · 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 · calendars.validate (cognitive 33) · ×1
  • calendars.validate (cognitive 33) agent/src/data_gateway/calendars.py:40 — calendars.validate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (7 pts), ternaries 3 (7 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:195 — 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:223 — 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:1208 — 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 · HistoryStorageSettings.HistoryStorageSettings (cognitive 33) · ×1
  • HistoryStorageSettings.HistoryStorageSettings (cognitive 33) frontend/src/components/settings/HistoryStorageSettings.tsx:9 — HistoryStorageSettings.HistoryStorageSettings has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (9 pts), ternaries 8 (9 pts), error handling 2 (nesting depth added 3). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 53, a function literal at line 130, act, …). 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 33) · ×1
  • api.errorFromResponse (cognitive 33) frontend/src/lib/api.ts:403 — api.errorFromResponse has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, ternaries 2 (4 pts), error handling 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 11 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 · options.buildPayoffRequest (cognitive 33) · ×1
  • options.buildPayoffRequest (cognitive 33) frontend/src/lib/options.ts:373 — options.buildPayoffRequest has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 13, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · 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 · 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 · figures._numbers (cognitive 32) · ×1
  • figures._numbers (cognitive 32) agent/evals/grounding/figures.py:483 — 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/evals/grounding/figures.py:939 — 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 · 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:6253 — _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 · _EvidenceMixin._record_backtest_outputs (cognitive 31) · ×1
  • _EvidenceMixin._record_backtest_outputs (cognitive 31) agent/evals/grounding/evidence.py:1069 — _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 · 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 · 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._query_claude_cli_models (cognitive 31) · ×1
  • claude_cli._query_claude_cli_models (cognitive 31) agent/src/providers/claude_cli.py:733 — claude_cli._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 · 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 · ConnectionCenter.ConnectionCenter (cognitive 31) · ×1
  • ConnectionCenter.ConnectionCenter (cognitive 31) frontend/src/components/portfolio/ConnectionCenter.tsx:21 — ConnectionCenter.ConnectionCenter has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 4, error handling 4, if/else 4, loops 1 (nesting depth added 5). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to 8 function items inside it that branch (remove, create, test, …). 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:2609 — _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 · 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 · historical.describe_coverage (cognitive 30) · ×1
  • historical.describe_coverage (cognitive 30) agent/src/data_gateway/historical.py:374 — historical.describe_coverage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, ternaries 4 (5 pts), error handling 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 · 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:2160 — 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:727 — 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 · 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:741 — 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:333 — 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:348 — 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:5327 — _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/evals/grounding/evidence.py:1660 — _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 · measurements.validate_measurements (cognitive 28) · ×1
  • measurements.validate_measurements (cognitive 28) agent/evals/harness/measurements.py:16 — measurements.validate_measurements has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, 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 · 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 · SwarmRuntime._execute_run (cognitive 28) · ×1
  • SwarmRuntime._execute_run (cognitive 28) agent/src/swarm/runtime.py:520 — SwarmRuntime._execute_run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (6 pts), boolean chains 3, ternaries 3, 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 · BackgroundManager.check (cognitive 28) · ×1
  • BackgroundManager.check (cognitive 28) agent/src/tools/background_tools.py:461 — 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:140 — 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:1120 — 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:883 — 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 · FutuLoader.fetch (cognitive 27) · ×1
  • FutuLoader.fetch (cognitive 27) agent/backtest/loaders/futu.py:150 — 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/evals/grounding/policies.py:2132 — _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 · history_source.fetch_chunk (cognitive 27) · ×1
  • history_source.fetch_chunk (cognitive 27) agent/src/data_gateway/history_source.py:69 — history_source.fetch_chunk has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:899 — 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 · service.catalog (cognitive 27) · ×1
  • service.catalog (cognitive 27) agent/src/research_lab/service.py:32 — service.catalog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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 · 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 · options.volatilitySurfaceIssue (cognitive 27) · ×1
  • options.volatilitySurfaceIssue (cognitive 27) frontend/src/lib/options.ts:292 — options.volatilitySurfaceIssue has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (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 · 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:333 — 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:221 — 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:727 — 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 · runner._select_market_engine (cognitive 26) · ×1
  • runner._select_market_engine (cognitive 26) agent/backtest/runner.py:1786 — runner._select_market_engine has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19 (24 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 · _SwarmDashboard.build_table (cognitive 26) · ×1
  • _SwarmDashboard.build_table (cognitive 26) agent/cli/_legacy.py:2237 — _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 · 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:1432 — 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:741 — 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 · 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 · validation._load_trades (cognitive 25) · ×1
  • validation._load_trades (cognitive 25) agent/backtest/validation.py:444 — 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 · instrument_identity._infer_instrument_type (cognitive 25) · ×1
  • instrument_identity._infer_instrument_type (cognitive 25) agent/src/agent/instrument_identity.py:345 — instrument_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 · execution.constructor_defaults (cognitive 25) · ×1
  • execution.constructor_defaults (cognitive 25) agent/src/research_lab/execution.py:39 — execution.constructor_defaults has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), error handling 1 (5 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · checkpoint.restore (cognitive 25) · ×1
  • checkpoint.restore (cognitive 25) agent/src/swarm/checkpoint.py:40 — checkpoint.restore has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, loops 3 (5 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 · 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:1808 — 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:116 — 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:453 — 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 · VolatilitySurfaceGrid.VolatilitySurfaceGrid (cognitive 25) · ×1
  • VolatilitySurfaceGrid.VolatilitySurfaceGrid (cognitive 25) frontend/src/components/options/VolatilitySurfaceGrid.tsx:25 — VolatilitySurfaceGrid.VolatilitySurfaceGrid has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 7, if/else 4 (5 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (compute, cellStyle, a function literal at line 46, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · 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 · evidence._metric_kind_for_path (cognitive 24) · ×1
  • evidence._metric_kind_for_path (cognitive 24) agent/evals/grounding/evidence.py:618 — 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 · assertions._tool_result_join_verdict (cognitive 24) · ×1
  • assertions._tool_result_join_verdict (cognitive 24) agent/evals/harness/assertions.py:735 — 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 · 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 · reads.read (cognitive 24) · ×1
  • reads.read (cognitive 24) agent/src/data_gateway/reads.py:50 — reads.read has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 3 (5 pts), ternaries 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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:296 — 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 · reconcile._issue_end_state (cognitive 24) · ×1
  • reconcile._issue_end_state (cognitive 24) agent/src/tools/paper_trade/reconcile.py:286 — reconcile._issue_end_state has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3, 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 · ResearchLabTool.execute (cognitive 24) · ×1
  • ResearchLabTool.execute (cognitive 24) agent/src/tools/research_lab_tool.py:36 — ResearchLabTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 3 (4 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · research_papers_tool._read_openalex (cognitive 24) · ×1
  • research_papers_tool._read_openalex (cognitive 24) agent/src/tools/research_papers_tool.py:1404 — 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) agent/src/trading/connectors/mt5/_client.py: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 · SoftwareUpdateSettings.SoftwareUpdateSettings (cognitive 24) · ×1
  • SoftwareUpdateSettings.SoftwareUpdateSettings (cognitive 24) frontend/src/components/settings/SoftwareUpdateSettings.tsx:5 — SoftwareUpdateSettings.SoftwareUpdateSettings has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 9, error handling 2 (nesting depth added 6). Of this number, 21 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.CorrelationAnalysis (cognitive 24) · ×1
  • Correlation.CorrelationAnalysis (cognitive 24) frontend/src/pages/Correlation.tsx:44 — Correlation.CorrelationAnalysis 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 · DataLoader.fetch (cognitive 23) · ×1
  • DataLoader.fetch (cognitive 23) agent/backtest/loaders/yfinance_loader.py:285 — 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 · runner.main (cognitive 23) · ×1
  • runner.main (cognitive 23) agent/backtest/runner.py:1461 — runner.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), error handling 6, 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 · 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 · figures._fenced_blocks (cognitive 23) · ×1
  • figures._fenced_blocks (cognitive 23) agent/evals/grounding/figures.py:681 — 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 · mcp_server.run_swarm (cognitive 23) · ×1
  • mcp_server.run_swarm (cognitive 23) agent/mcp_server.py:1965 — 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 · 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 · bar_artifact.export_bars_csv (cognitive 23) · ×1
  • bar_artifact.export_bars_csv (cognitive 23) agent/src/data_gateway/bar_artifact.py:21 — bar_artifact.export_bars_csv has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 2, 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 · 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 · 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:327 — 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:214 — 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:261 — 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 · shannon.parseHoldings (cognitive 23) · ×1
  • shannon.parseHoldings (cognitive 23) frontend/src/lib/shannon.ts:37 — shannon.parseHoldings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:469 — 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:774 — 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:1340 — 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:2166 — _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:2059 — _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 · _EvidenceMixin._ingest_analysis_result (cognitive 22) · ×1
  • _EvidenceMixin._ingest_analysis_result (cognitive 22) agent/evals/grounding/evidence.py:873 — _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 · FiguresBlock.match (cognitive 22) · ×1
  • FiguresBlock.match (cognitive 22) agent/evals/grounding/figures.py:180 — FiguresBlock.match has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 2 (3 pts), 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 · assertions._tool_verdicts (cognitive 22) · ×1
  • assertions._tool_verdicts (cognitive 22) agent/evals/harness/assertions.py:261 — 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 · 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:203 — 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 · history_router.inventory (cognitive 22) · ×1
  • history_router.inventory (cognitive 22) agent/src/data_gateway/history_router.py:33 — history_router.inventory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoryStore.read (cognitive 22) · ×1
  • HistoryStore.read (cognitive 22) agent/src/data_gateway/history_store.py:720 — HistoryStore.read has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · llm._build_anthropic (cognitive 22) · ×1
  • llm._build_anthropic (cognitive 22) agent/src/providers/llm.py:1232 — llm._build_anthropic has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 3 (5 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution.freeze_run (cognitive 22) · ×1
  • execution.freeze_run (cognitive 22) agent/src/research_lab/execution.py:62 — execution.freeze_run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:128 — 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 · OptionsPayoffTool._execute_single (cognitive 22) · ×1
  • OptionsPayoffTool._execute_single (cognitive 22) agent/src/tools/options_payoff_tool.py:203 — OptionsPayoffTool._execute_single has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 3 (5 pts), error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · engine.run_day_loop (cognitive 22) · ×1
  • engine.run_day_loop (cognitive 22) agent/src/tools/paper_trade/engine.py:636 — 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 · 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 · SwarmStatusCard.SwarmStatusCard (cognitive 22) · ×1
  • SwarmStatusCard.SwarmStatusCard (cognitive 22) frontend/src/components/chat/SwarmStatusCard.tsx:182 — SwarmStatusCard.SwarmStatusCard has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), error handling 4, ternaries 2 (nesting depth added 1). Of this number, 11 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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:2012 — _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:2719 — _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 · main._render_mandate_proposal (cognitive 21) · ×1
  • main._render_mandate_proposal (cognitive 21) agent/cli/main.py:1008 — 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 · result_artifacts.persist_calculation_result (cognitive 21) · ×1
  • result_artifacts.persist_calculation_result (cognitive 21) agent/src/agent/result_artifacts.py:16 — result_artifacts.persist_calculation_result has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (4 pts), error handling 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 · 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:1309 — 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:662 — 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:1021 — 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 · _MatchSession._day_gate (cognitive 21) · ×1
  • _MatchSession._day_gate (cognitive 21) agent/src/tools/paper_trade/engine.py:276 — _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:1017 — 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:85 — 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 · options.buildVolatilitySurfaceRequest (cognitive 21) · ×1
  • options.buildVolatilitySurfaceRequest (cognitive 21) frontend/src/lib/options.ts:258 — options.buildVolatilitySurfaceRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, ternaries 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseEngine.historical_base_price (cognitive 20) · ×1
  • BaseEngine.historical_base_price (cognitive 20) agent/backtest/engines/base.py:725 — 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:585 — 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 · _legacy.cmd_init (cognitive 20) · ×1
  • _legacy.cmd_init (cognitive 20) agent/cli/_legacy.py:5997 — _legacy.cmd_init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (7 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp_server.alpha_bench (cognitive 20) · ×1
  • mcp_server.alpha_bench (cognitive 20) agent/mcp_server.py:1059 — 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 · sources.cboe_options (cognitive 20) · ×1
  • sources.cboe_options (cognitive 20) agent/src/data_gateway/sources.py:131 — sources.cboe_options has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Topic.parse (cognitive 20) · ×1
  • Topic.parse (cognitive 20) agent/src/data_gateway/streams.py:34 — Topic.parse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base.downside_beta (cognitive 20) · ×1
  • base.downside_beta (cognitive 20) agent/src/factors/base.py:517 — base.downside_beta has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1203 — 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 · execution.trial (cognitive 20) · ×1
  • execution.trial (cognitive 20) agent/src/research_lab/execution.py:138 — execution.trial has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 1 (3 pts), loops 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:576 — 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:184 — 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:152 — 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 · ResearchLab.ResearchLab · ×1
  • ResearchLab.ResearchLab::submit (cognitive 20) frontend/src/pages/ResearchLab.tsx:96 — ResearchLab.ResearchLab::submit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (3 pts), loops 1 (2 pts), boolean chains 1, 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. This shape REPEATS in the file: one other method here (ResearchLab.ResearchLab) 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 · 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:1634 — 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:2388 — 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 · baostock_loader._session_admission (cognitive 19) · ×1
  • baostock_loader._session_admission (cognitive 19) agent/backtest/loaders/baostock_loader.py:43 — baostock_loader._session_admission has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader.fetch (cognitive 19) · ×1
  • DataLoader.fetch (cognitive 19) REDACTED:82 — DataLoader.fetch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataLoader._request_page (cognitive 19) · ×1
  • DataLoader._request_page (cognitive 19) REDACTED:158 — 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:1074 — 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 · ToolCallLifecycle._batch_execute (cognitive 19) · ×1
  • ToolCallLifecycle._batch_execute (cognitive 19) agent/src/agent/tool_lifecycle.py:535 — 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 · StreamHub._run (cognitive 19) · ×1
  • StreamHub._run (cognitive 19) agent/src/data_gateway/streams.py:311 — StreamHub._run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (7 pts), error handling 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 · audit.audit_factors (cognitive 19) · ×1
  • audit.audit_factors (cognitive 19) agent/src/factors/audit.py:58 — audit.audit_factors has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), loops 2, 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 · 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:566 — 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 · settings.get_llm_credentials (cognitive 19) · ×1
  • settings.get_llm_credentials (cognitive 19) agent/src/providers/settings.py:173 — settings.get_llm_credentials has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, ternaries 3 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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:191 — 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:118 — 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:570 — 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:722 — 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 · _MatchSession._fill_gate (cognitive 19) · ×1
  • _MatchSession._fill_gate (cognitive 19) agent/src/tools/paper_trade/engine.py:323 — _MatchSession._fill_gate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 4 (6 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 · 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:187 — 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 · update-verification.verifyWindowsUpdateCandidate (cognitive 19) · ×1
  • update-verification.verifyWindowsUpdateCandidate (cognitive 19) desktop/electron/src/update-verification.ts:53 — update-verification.verifyWindowsUpdateCandidate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, 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 · 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 · ResearchLab.ResearchLab (cognitive 19) · ×1
  • ResearchLab.ResearchLab (cognitive 19) frontend/src/pages/ResearchLab.tsx:20 — ResearchLab.ResearchLab has cognitive complexity 19 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 27, loops 3 (5 pts), ternaries 3 (5 pts), error handling 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (ResearchLab.ResearchLab::submit) 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 · 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:430 — 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:77 — 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:190 — 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._fetch_candles (cognitive 18) · ×1
  • DataLoader._fetch_candles (cognitive 18) agent/backtest/loaders/okx.py:227 — DataLoader._fetch_candles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 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 · DataLoader._merge_basic_fields (cognitive 18) · ×1
  • DataLoader._merge_basic_fields (cognitive 18) agent/backtest/loaders/tushare.py:278 — 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:205 — 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._show_settings (cognitive 18) · ×1
  • _legacy._show_settings (cognitive 18) agent/cli/_legacy.py:1894 — _legacy._show_settings has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, ternaries 5 (6 pts), 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._handle_slash_command (cognitive 18) · ×1
  • _legacy._handle_slash_command (cognitive 18) agent/cli/_legacy.py:1953 — _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:2928 — _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:4568 — _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/evals/grounding/figures.py:380 — 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/evals/grounding/figures.py:1051 — 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/evals/grounding/figures.py:1219 — 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 · _PolicyMixin._other_call_field_ref_candidates (cognitive 18) · ×1
  • _PolicyMixin._other_call_field_ref_candidates (cognitive 18) agent/evals/grounding/policies.py:1296 — _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 · 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 · history_router.candidates (cognitive 18) · ×1
  • history_router.candidates (cognitive 18) agent/src/data_gateway/history_router.py:79 — history_router.candidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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 · HistoryStore._recover_interrupted (cognitive 18) · ×1
  • HistoryStore._recover_interrupted (cognitive 18) agent/src/data_gateway/history_store.py:80 — HistoryStore._recover_interrupted has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (8 pts), if/else 2 (4 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarketDataGateway.submit_source (cognitive 18) · ×1
  • MarketDataGateway.submit_source (cognitive 18) agent/src/data_gateway/service.py:279 — MarketDataGateway.submit_source has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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 · 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 · preflight._check_llm_provider (cognitive 18) · ×1
  • preflight._check_llm_provider (cognitive 18) agent/src/preflight.py:31 — preflight._check_llm_provider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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:114 — 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 · institutional_holdings_tool._information_table_urls (cognitive 18) · ×1
  • institutional_holdings_tool._information_table_urls (cognitive 18) agent/src/tools/institutional_holdings_tool.py:661 — 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:152 — 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:124 — 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 · 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:75 — 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:1749 — 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:176 — 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._paginate (cognitive 17) · ×1
  • DataLoader._paginate (cognitive 17) agent/backtest/loaders/okx.py:292 — DataLoader._paginate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 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 · registry.refresh_source_order_overrides (cognitive 17) · ×1
  • registry.refresh_source_order_overrides (cognitive 17) agent/backtest/loaders/registry.py:539 — registry.refresh_source_order_overrides has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · valuation_loader._load_baostock_valuation (cognitive 17) · ×1
  • valuation_loader._load_baostock_valuation (cognitive 17) agent/backtest/loaders/valuation_loader.py:172 — valuation_loader._load_baostock_valuation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metrics.win_rate_and_stats (cognitive 17) · ×1
  • metrics.win_rate_and_stats (cognitive 17) agent/backtest/metrics.py:386 — 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 · risk_xray.compute_risk_xray (cognitive 17) · ×1
  • risk_xray.compute_risk_xray (cognitive 17) agent/backtest/risk_xray.py:94 — risk_xray.compute_risk_xray has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 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 · validation.monte_carlo_test (cognitive 17) · ×1
  • validation.monte_carlo_test (cognitive 17) agent/backtest/validation.py:33 — validation.monte_carlo_test has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, 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 · _legacy.cmd_swarm_show (cognitive 17) · ×1
  • _legacy.cmd_swarm_show (cognitive 17) agent/cli/_legacy.py:2827 — _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:3220 — _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:5817 — _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 · _PolicyMixin._unknown_call_field_ref_candidates (cognitive 17) · ×1
  • _PolicyMixin._unknown_call_field_ref_candidates (cognitive 17) agent/evals/grounding/policies.py:1362 — _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/evals/grounding/policies.py:2664 — 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 · 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 · 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:185 — 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 · 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 · HistoryStore.status (cognitive 17) · ×1
  • HistoryStore.status (cognitive 17) agent/src/data_gateway/history_store.py:372 — HistoryStore.status has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · discovery._list_provider_models (cognitive 17) · ×1
  • discovery._list_provider_models (cognitive 17) agent/src/providers/discovery.py:201 — discovery._list_provider_models has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, 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 · 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 · registry.get_provider_capabilities (cognitive 17) · ×1
  • registry.get_provider_capabilities (cognitive 17) agent/src/providers/registry.py:189 — registry.get_provider_capabilities has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 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 · 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 · SwarmRuntime._run_worker_with_retries (cognitive 17) · ×1
  • SwarmRuntime._run_worker_with_retries (cognitive 17) agent/src/swarm/runtime.py:1178 — SwarmRuntime._run_worker_with_retries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp.compact_result_for_agent (cognitive 17) · ×1
  • mcp.compact_result_for_agent (cognitive 17) agent/src/tools/mcp.py:1255 — 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:82 — 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 · 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 · 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:2346 — 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 · frozen.load_frozen_frames (cognitive 16) · ×1
  • frozen.load_frozen_frames (cognitive 16) agent/backtest/frozen.py:15 — frozen.load_frozen_frames has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 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 · 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 · rsshub_events.enrich_price_frames_with_events (cognitive 16) · ×1
  • rsshub_events.enrich_price_frames_with_events (cognitive 16) REDACTED:528 — 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 · 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.write_run_card (cognitive 16) · ×1
  • run_card.write_run_card (cognitive 16) agent/backtest/run_card.py:168 — run_card.write_run_card has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, 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 · run_card._normalize_tool_traces (cognitive 16) · ×1
  • run_card._normalize_tool_traces (cognitive 16) agent/backtest/run_card.py:423 — 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:819 — 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 · validation.bootstrap_sharpe_ci (cognitive 16) · ×1
  • validation.bootstrap_sharpe_ci (cognitive 16) agent/backtest/validation.py:152 — validation.bootstrap_sharpe_ci has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, 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 · _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:784 — 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 · figures._writes_decimal_commas (cognitive 16) · ×1
  • figures._writes_decimal_commas (cognitive 16) agent/evals/grounding/figures.py:610 — 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 · assertions._evidence_verdicts (cognitive 16) · ×1
  • assertions._evidence_verdicts (cognitive 16) agent/evals/harness/assertions.py:456 — assertions._evidence_verdicts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 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 · 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 · run_outcome.resolve_final_status (cognitive 16) · ×1
  • run_outcome.resolve_final_status (cognitive 16) agent/src/agent/run_outcome.py:119 — run_outcome.resolve_final_status has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 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 · 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 · attribution_core._attribution_brinson_asset_class_mode (cognitive 16) · ×1
  • attribution_core._attribution_brinson_asset_class_mode (cognitive 16) agent/src/api/attribution_core.py:656 — attribution_core._attribution_brinson_asset_class_mode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · dotenv._write_env_values (cognitive 16) · ×1
  • dotenv._write_env_values (cognitive 16) agent/src/config/dotenv.py:132 — dotenv._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 · 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 · StreamHub._hybrid (cognitive 16) · ×1
  • StreamHub._hybrid (cognitive 16) agent/src/data_gateway/streams.py:351 — StreamHub._hybrid has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (6 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 · 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:251 — 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 · chat._parse_dsml_tool_calls (cognitive 16) · ×1
  • chat._parse_dsml_tool_calls (cognitive 16) agent/src/providers/chat.py:292 — 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:1164 — 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:1045 — 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 · gildata_identity.search_candidates (cognitive 16) · ×1
  • gildata_identity.search_candidates (cognitive 16) agent/src/tools/gildata_identity.py:8 — gildata_identity.search_candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, loops 2 (3 pts), error handling 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:383 — 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:351 — 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:778 — 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:531 — 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:943 — 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:1525 — 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 · StrategyBuilder.StrategyBuilder (cognitive 16) · ×1
  • StrategyBuilder.StrategyBuilder (cognitive 16) frontend/src/components/options/StrategyBuilder.tsx:25 — StrategyBuilder.StrategyBuilder has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 13, boolean chains 2, if/else 1. Of this number, 8 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D32 · Data Compliance (PII/GDPR) · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (3 members, 49 shared lines) · ×1
  • Near-duplicate member family (3 members, 49 shared lines) agent/backtest/loaders/akshare_loader.py:135 — agent/backtest/loaders/akshare_loader.py:135-205 | agent/backtest/loaders/eastmoney_loader.py:80-160 | REDACTED:91-156 — These 3 members are variants of one another: a block of 49 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 · 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 · Edited copy of a member (155 corresponding lines) · ×1
  • Edited copy of a member (155 corresponding lines) agent/src/entities/ingest.py:379 — agent/src/entities/ingest.py:379-535 | agent/src/entities/ingest.py:942-1096 — These two members are one piece of code written twice and then edited apart: 155 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 (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) agent/backtest/loaders/nobitex.py:198 — agent/backtest/loaders/nobitex.py:198-285 | agent/backtest/loaders/wallex.py:196-269 — These two members are one piece of code written twice and then edited apart: 74 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 (99 corresponding lines) · ×1
  • Edited copy of a member (99 corresponding lines) agent/backtest/loaders/fmp_loader.py:221 — agent/backtest/loaders/fmp_loader.py:221-324 | agent/backtest/loaders/tiingo_loader.py:165-263 — These two members are one piece of code written twice and then edited apart: 99 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 (83 corresponding lines) · ×1
  • Edited copy of a member (83 corresponding lines) agent/src/skills/elliott-wave/example_signal_engine.py:189 — agent/src/skills/elliott-wave/example_signal_engine.py:189-283 | agent/src/skills/elliott-wave/example_signal_engine.py:286-368 — These two members are one piece of code written twice and then edited apart: 83 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 (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) agent/src/trading/connectors/kis/sdk.py:686 — agent/src/trading/connectors/kis/sdk.py:686-739 | agent/src/trading/connectors/toss/sdk.py:450-501 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) agent/src/tools/goal_tool.py:279 — agent/src/tools/goal_tool.py:279-314 | agent/src/tools/goal_tool.py:346-383 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) agent/backtest/loaders/nobitex.py:138 — agent/backtest/loaders/nobitex.py:138-188 | agent/backtest/loaders/wallex.py:136-186 — These two members are one piece of code written twice and then edited apart: 51 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 (68 corresponding lines) · ×1
  • Edited copy of a member (68 corresponding lines) agent/src/trading/connectors/dhan/sdk.py:453 — agent/src/trading/connectors/dhan/sdk.py:453-523 | agent/src/trading/connectors/shoonya/sdk.py:434-501 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) agent/src/tools/trade_journal_parsers.py:381 — agent/src/tools/trade_journal_parsers.py:381-405 | agent/src/tools/trade_journal_parsers.py:668-691 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×1
  • Edited copy of a member (39 corresponding lines) agent/src/tools/institutional_holdings_tool.py:823 — agent/src/tools/institutional_holdings_tool.py:823-861 | agent/src/tools/institutional_holdings_tool.py:1115-1161 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) agent/src/factors/zoo/alpha101/alpha_077.py:56 — agent/src/factors/zoo/alpha101/alpha_077.py:56-73 | agent/src/factors/zoo/alpha101/alpha_088.py:56-73 | agent/src/factors/zoo/alpha101/alpha_092.py:56-80 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) agent/src/live/enforcement.py:247 — agent/src/live/enforcement.py:247-289 | agent/src/live/enforcement.py:744-780 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 59+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 59+ corresponding lines) agent/src/quantlib/valuation/artifact.py:701 — agent/src/quantlib/valuation/artifact.py:701-769 | agent/src/quantlib/valuation/artifact.py:780-838 | agent/src/quantlib/valuation/artifact.py:851-921 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 59 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×1
  • Edited copy of a member (43 corresponding lines) agent/src/entities/ingest.py:94 — agent/src/entities/ingest.py:94-136 | agent/src/entities/ingest.py:748-797 — These two members are one piece of code written twice and then edited apart: 43 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 (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) agent/backtest/loaders/mt5_loader.py:209 — agent/backtest/loaders/mt5_loader.py:209-241 | agent/backtest/loaders/tickerall_loader.py:233-299 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×1
  • Edited copy of a member (53 corresponding lines) agent/backtest/engines/korea_equity.py:176 — agent/backtest/engines/korea_equity.py:176-228 | agent/backtest/engines/vietnam_equity.py:269-326 — These two members are one piece of code written twice and then edited apart: 53 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 (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) agent/src/trading/connectors/kis/sdk.py:430 — agent/src/trading/connectors/kis/sdk.py:430-467 | agent/src/trading/connectors/toss/sdk.py:350-383 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 16+ corresponding lines) agent/src/trading/connectors/alpaca/sdk.py:91 — agent/src/trading/connectors/alpaca/sdk.py:91-106 | agent/src/trading/connectors/longbridge/sdk.py:88-106 | agent/src/trading/connectors/toss/sdk.py:87-103 | agent/src/trading/connectors/trading212/sdk.py:74-89 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) agent/src/portfolio/config.py:291 — agent/src/portfolio/config.py:291-320 | agent/src/trading/connections.py:429-458 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 36+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 36+ corresponding lines) agent/backtest/loaders/alphavantage_loader.py:121 — agent/backtest/loaders/alphavantage_loader.py:121-168 | agent/backtest/loaders/finnhub_loader.py:176-233 | agent/backtest/loaders/fmp_loader.py:102-148 | agent/backtest/loaders/pykrx_loader.py:101-144 | agent/backtest/loaders/sina_loader.py:146-181 | agent/backtest/loaders/stooq_loader.py:186-231 | agent/backtest/loaders/tiingo_loader.py:291-346 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 36 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 15+ corresponding lines) agent/src/trading/connectors/etoro/copy_trading.py:134 — agent/src/trading/connectors/etoro/copy_trading.py:134-151 | agent/src/trading/connectors/etoro/copy_trading.py:161-187 | agent/src/trading/connectors/etoro/trading.py:115-136 | agent/src/trading/connectors/etoro/trading.py:201-215 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×1
  • Edited copy of a member (35 corresponding lines) agent/src/trading/connectors/alpaca/sdk.py:266 — agent/src/trading/connectors/alpaca/sdk.py:266-300 | agent/src/trading/connectors/ibkr/local.py:193-241 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 12+ corresponding lines) agent/src/trading/connectors/dhan/sdk.py:96 — agent/src/trading/connectors/dhan/sdk.py:96-107 | agent/src/trading/connectors/etoro/client.py:80-91 | agent/src/trading/connectors/kis/sdk.py:139-152 | agent/src/trading/connectors/tiger/sdk.py:85-97 | agent/src/trading/connectors/upbit/sdk.py:90-101 | agent/src/trading/connectors/zerodha/sdk.py:93-104 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) agent/src/quantlib/valuation/comps.py:431 — agent/src/quantlib/valuation/comps.py:431-521 | agent/src/quantlib/valuation/comps.py:533-592 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) agent/src/trading/service.py:224 — agent/src/trading/service.py:224-243 | agent/src/trading/service.py:272-291 | agent/src/trading/service.py:300-325 | agent/src/trading/service.py:338-376 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 18+ corresponding lines) agent/src/factors/zoo/gtja191/alpha_108.py:55 — agent/src/factors/zoo/gtja191/alpha_108.py:55-75 | agent/src/factors/zoo/gtja191/alpha_121.py:55-72 | agent/src/factors/zoo/gtja191/alpha_131.py:55-72 | agent/src/factors/zoo/gtja191/alpha_156.py:55-74 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) agent/src/factors/zoo/alpha101/alpha_068.py:56 — agent/src/factors/zoo/alpha101/alpha_068.py:56-70 | agent/src/factors/zoo/alpha101/alpha_074.py:61-79 | agent/src/factors/zoo/alpha101/alpha_086.py:61-75 | agent/src/factors/zoo/alpha101/alpha_099.py:61-74 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×1
  • Edited copy of a member (38 corresponding lines) agent/src/live/runtime/sweep_latch.py:75 — agent/src/live/runtime/sweep_latch.py:75-113 | agent/src/live/runtime/sweep_latch.py:227-264 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 35+ corresponding lines) agent/src/quantlib/valuation/artifact.py:1181 — agent/src/quantlib/valuation/artifact.py:1181-1219 | agent/src/quantlib/valuation/artifact.py:1305-1339 | agent/src/quantlib/valuation/artifact.py:1418-1456 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) agent/src/factors/zoo/alpha101/alpha_075.py:56 — agent/src/factors/zoo/alpha101/alpha_075.py:56-69 | agent/src/factors/zoo/gtja191/alpha_101.py:56-73 | agent/src/factors/zoo/gtja191/alpha_123.py:55-71 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 7+ corresponding lines) agent/src/factors/zoo/gtja191/alpha_061.py:50 — agent/src/factors/zoo/gtja191/alpha_061.py:50-56 | agent/src/factors/zoo/gtja191/alpha_077.py:50-58 | agent/src/factors/zoo/gtja191/alpha_092.py:50-57 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 15+ corresponding lines) agent/src/tools/trading_connector_tool.py:933 — agent/src/tools/trading_connector_tool.py:933-950 | agent/src/tools/trading_connector_tool.py:972-986 | agent/src/tools/trading_connector_tool.py:1061-1078 | agent/src/tools/trading_connector_tool.py:1108-1126 | agent/src/tools/trading_connector_tool.py:1148-1162 | agent/src/tools/trading_connector_tool.py:1189-1205 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×1
  • Edited copy of a member (41 corresponding lines) agent/src/tools/sector_tool.py:162 — agent/src/tools/sector_tool.py:162-204 | agent/src/tools/sector_tool.py:259-299 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) agent/src/quantlib/fundmath.py:1254 — agent/src/quantlib/fundmath.py:1254-1308 | agent/src/quantlib/fundmath.py:2102-2155 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 13+ corresponding lines) agent/src/tools/trading_connector_tool.py:402 — agent/src/tools/trading_connector_tool.py:402-415 | agent/src/tools/trading_connector_tool.py:601-613 | agent/src/tools/trading_connector_tool.py:679-691 | agent/src/tools/trading_connector_tool.py:716-728 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) agent/src/factors/zoo/alpha101/alpha_069.py:86 — agent/src/factors/zoo/alpha101/alpha_069.py:86-98 | agent/src/factors/zoo/alpha101/alpha_070.py:86-98 | agent/src/factors/zoo/alpha101/alpha_090.py:86-97 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 17+ corresponding lines) agent/src/factors/zoo/gtja191/alpha_109.py:54 — agent/src/factors/zoo/gtja191/alpha_109.py:54-71 | agent/src/factors/zoo/gtja191/alpha_111.py:54-71 | agent/src/factors/zoo/gtja191/alpha_158.py:54-70 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) agent/src/factors/zoo/gtja191/alpha_122.py:54 — agent/src/factors/zoo/gtja191/alpha_122.py:54-68 | agent/src/factors/zoo/gtja191/alpha_152.py:54-70 | agent/src/factors/zoo/gtja191/alpha_169.py:54-68 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) agent/src/api/runs_routes.py:65 — agent/src/api/runs_routes.py:65-79 | agent/src/tools/backtest_summary.py:194-206 | agent/src/tools/trade_journal_tool.py:657-669 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 11+ corresponding lines) REDACTED:92 — REDACTED:92-102 | agent/src/channels/slack.py:757-767 | agent/src/channels/telegram.py:183-193 | agent/src/tools/report_audit_tool.py:134-144 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 10+ corresponding lines) agent/src/governance/ledger.py:329 — agent/src/governance/ledger.py:329-340 | agent/src/live/daily_count.py:53-62 | agent/src/providers/openai_codex.py:131-140 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 2+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 2+ corresponding lines) agent/src/tools/paper_trade/data.py:143 — agent/src/tools/paper_trade/data.py:143-144 | agent/src/tools/paper_trade/data_5m.py:234-235 | agent/src/tools/paper_trade/strategy_exec.py:175-176 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 2 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 4+ corresponding lines) agent/src/tools/fred_macro_tool.py:266 — agent/src/tools/fred_macro_tool.py:266-269 | agent/src/tools/research_reports_tool.py:384-387 | agent/src/tools/shareholder_count_tool.py:285-288 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 4+ corresponding lines) agent/src/factors/zoo/qlib158/imxd10.py:27 — agent/src/factors/zoo/qlib158/imxd10.py:27-30 | agent/src/factors/zoo/qlib158/imxd20.py:27-30 | agent/src/factors/zoo/qlib158/imxd30.py:27-30 | agent/src/factors/zoo/qlib158/imxd5.py:27-30 | agent/src/factors/zoo/qlib158/imxd60.py:27-30 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (2 corresponding lines) · ×1
  • Edited copy of a member (2 corresponding lines) agent/src/quantlib/combination.py:93 — agent/src/quantlib/combination.py:93-94 | agent/src/quantlib/neutralization.py:73-74 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (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:641-694 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `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:640` 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 (45–53 lines × 2) · ×1
  • Duplicated block (45–53 lines × 2) agent/backtest/loaders/akshare_loader.py:135 — agent/backtest/loaders/akshare_loader.py:135-179 | agent/backtest/loaders/eastmoney_loader.py:80-132 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 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:755 — agent/backtest/engines/base.py:755-758 | 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:256 — agent/src/quantlib/risk.py:256-282 | agent/src/quantlib/risk.py:330-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.
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 (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 (23–28 lines × 2) · ×1
  • Duplicated block (23–28 lines × 2) agent/src/agent/instrument_identity.py:268 — agent/src/agent/instrument_identity.py:268-295 | agent/src/agent/instrument_identity.py:370-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) 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 (14–27 lines × 2) · ×1
  • Duplicated block (14–27 lines × 2) agent/src/tools/orderbook_depth_tool.py:178 — agent/src/tools/orderbook_depth_tool.py:178-191 | agent/src/tools/prediction_market_tool.py:949-975 — 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:3162 — agent/cli/_legacy.py:3162-3187 | agent/cli/_legacy.py:3191-3204 — both copies are in the same file, so extract the 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:114 — agent/src/tools/research_reports_tool.py:114-139 | agent/src/tools/shareholder_count_tool.py:86-109 — 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 (23–24 lines × 3) · ×1
  • Duplicated block (23–24 lines × 3) agent/backtest/loaders/akshare_loader.py:183 — agent/backtest/loaders/akshare_loader.py:183-205 | agent/backtest/loaders/eastmoney_loader.py:137-160 | REDACTED:133-156 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 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:183` 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 (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 (19–20 lines × 2) · ×1
  • 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 (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 (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:616-624 — 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:616` 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 (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) agent/src/strategy_store/sqlite_store.py:409 — agent/src/strategy_store/sqlite_store.py:409-441 | agent/src/strategy_store/sqlite_store.py:584-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.
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:155 — agent/src/tools/block_trades_tool.py:155-172 | agent/src/tools/symbol_search_tool.py:739-748 — 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:749 — agent/src/swarm/worker.py:749-765 | agent/src/swarm/worker.py:771-787 | agent/src/swarm/worker.py:815-831 | agent/src/swarm/worker.py:950-966 — 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 (10–17 lines × 2) · ×1
  • Duplicated block (10–17 lines × 2) agent/src/providers/chat.py:370 — agent/src/providers/chat.py:370-386 | agent/src/providers/chat.py:392-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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:70 — agent/src/tools/web_search_tool.py:70-85 | agent/src/tools/web_search_tool.py:105-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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 | agent/src/trading/connectors/mt5/_client.py: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 (10–16 lines × 6) · ×1
  • Duplicated block (10–16 lines × 6) agent/mcp_server.py:953 — agent/mcp_server.py:953-968 | 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 (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) agent/backtest/loaders/fmp_loader.py:133 — agent/backtest/loaders/fmp_loader.py:133-148 | agent/backtest/loaders/pykrx_loader.py:129-144 | agent/backtest/loaders/sina_loader.py:166-181 | agent/backtest/loaders/stooq_loader.py:216-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 (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:168 — agent/backtest/loaders/akshare_loader.py:168-181 | agent/backtest/loaders/eastmoney_loader.py:120-134 | REDACTED:117-130 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 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:168` 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:222 — agent/backtest/loaders/yahoo_client.py:222-236 | agent/backtest/loaders/yahoo_client.py:350-357 | agent/backtest/loaders/yahoo_client.py:412-419 — 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:170-183 — 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 (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) REDACTED:973 — REDACTED:973-986 | REDACTED:1003-1013 — both copies are in the same file, so extract the 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:973` 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 (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) agent/backtest/loaders/alphavantage_loader.py:151 — agent/backtest/loaders/alphavantage_loader.py:151-163 | agent/backtest/loaders/finnhub_loader.py:216-228 | agent/backtest/loaders/tiingo_loader.py:327-339 | agent/backtest/loaders/yahoo_loader.py:252-264 — 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 (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) agent/backtest/loaders/akshare_loader.py:155 — agent/backtest/loaders/akshare_loader.py:155-166 | agent/backtest/loaders/eastmoney_loader.py:106-118 | REDACTED:104-115 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 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:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) agent/backtest/loaders/alphavantage_loader.py:156 — agent/backtest/loaders/alphavantage_loader.py:156-168 | agent/backtest/loaders/finnhub_loader.py:221-233 | agent/backtest/loaders/mootdx_loader.py:151-161 — 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/alphavantage_loader.py:156` 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 × 6) · ×1
  • Duplicated block (12 lines × 6) agent/backtest/loaders/alphavantage_loader.py:148 — agent/backtest/loaders/alphavantage_loader.py:148-159 | agent/backtest/loaders/finnhub_loader.py:213-224 | agent/backtest/loaders/fmp_loader.py:130-141 | agent/backtest/loaders/pykrx_loader.py:125-137 | agent/backtest/loaders/stooq_loader.py:212-224 | agent/backtest/loaders/tiingo_loader.py:324-335 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/alphavantage_loader.py:148` 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 (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:255-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `agent/backtest/loaders/yahoo_loader.py:268` calls `acquisition_error_kind` and `agent/backtest/loaders/alphavantage_loader.py:167` 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 (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 (18 lines × 10) · ×1
  • Duplicated block (18 lines × 10) 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 — 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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/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 (10–11 lines × 8) · ×1
  • Duplicated block (10–11 lines × 8) agent/backtest/loaders/alphavantage_loader.py:150 — agent/backtest/loaders/alphavantage_loader.py:150-160 | 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/sina_loader.py:165-174 | agent/backtest/loaders/stooq_loader.py:215-224 | agent/backtest/loaders/tiingo_loader.py:326-336 | agent/backtest/loaders/yahoo_loader.py:251-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/backtest/loaders/alphavantage_loader.py:150` 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 (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:159 — agent/backtest/loaders/akshare_loader.py:159-168 | agent/backtest/loaders/alphavantage_loader.py:152-163 | agent/backtest/loaders/eastmoney_loader.py:110-121 | 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:253-264 — before extracting anything, compare `agent/backtest/loaders/akshare_loader.py` and `agent/backtest/loaders/eastmoney_loader.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 130 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 × 5) · ×1
  • Duplicated block (10 lines × 5) agent/backtest/loaders/fmp_loader.py:134 — agent/backtest/loaders/fmp_loader.py:134-143 | agent/backtest/loaders/pykrx_loader.py:130-139 | agent/backtest/loaders/sina_loader.py:167-176 | agent/backtest/loaders/stooq_loader.py:217-226 | REDACTED:108-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (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 (10 lines × 10) · ×1
  • Duplicated block (10 lines × 10) 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 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) agent/src/skills/candlestick/example_signal_engine.py:557 — agent/src/skills/candlestick/example_signal_engine.py:557-563 | agent/src/skills/elliott-wave/example_signal_engine.py:438-444 | agent/src/skills/harmonic/example_signal_engine.py:455-461 | agent/src/skills/ichimoku/example_signal_engine.py:159-165 | agent/src/skills/smc/example_signal_engine.py:47-53 | agent/src/skills/technical-basic/example_signal_engine.py:271-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 × 3) · ×1
  • 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.
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 (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.
D4 · Code Duplication · Near-duplicate member pair (51 shared lines) · ×1
  • Near-duplicate member pair (51 shared lines) tools/gateway_minute_restart_probe.py:85 — tools/gateway_minute_restart_probe.py:85-298 | tools/gateway_ten_job_restart_probe.py:230-471 — These two members are variants of one another: 51 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) tools/gateway_full_scan_probe.py:80 — tools/gateway_full_scan_probe.py:80-86 | tools/gateway_minute_restart_probe.py:109-117 | tools/gateway_ten_job_restart_probe.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 all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/gateway_full_scan_probe.py:88` calls `monotonic` and `tools/gateway_ten_job_restart_probe.py:264` 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.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (24 clone groups) · ×1
  • Duplication concentrated across 2 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, pages — 8 of them are reported below, and 16 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:48 — 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 (64 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (64 matched lines × 2 locations) frontend/src/lib/api.ts:674 — frontend/src/lib/api.ts:674 · frontend/src/lib/api.ts:843 — 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 (33 lines × 2 locations) · ×1
  • Duplicated block (33 lines × 2 locations) frontend/src/pages/Settings.tsx:658 — frontend/src/pages/Settings.tsx:658 · frontend/src/pages/Settings.tsx:693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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 (17 lines × 2 locations) · ×1
  • Duplicated block (17 lines × 2 locations) frontend/src/pages/Settings.tsx:621 — frontend/src/pages/Settings.tsx:621 · frontend/src/pages/Settings.tsx:735 — 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 (15 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (15 matched lines × 2 locations) frontend/src/components/portfolio/ConnectionCenter.tsx:74 — frontend/src/components/portfolio/ConnectionCenter.tsx:74 · frontend/src/components/portfolio/ConnectionCenter.tsx:103 — the two spans are one implementation copied and then locally edited — 73 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (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.
R10 · Code Duplication · Duplicated block (11 lines × 2 locations) · ×1
  • 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.
R2 · Cyclomatic Complexity · Complex function OptionsLab (cyclomatic 47, cognitive 42) · ×1
  • Complex function OptionsLab (cyclomatic 47, cognitive 42) frontend/src/pages/OptionsLab.tsx:61 — OptionsLab has cyclomatic complexity 47 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 45, cognitive 72) · ×1
  • Complex function (anonymous) (cyclomatic 45, cognitive 72) frontend/src/pages/Agent.tsx:539 — (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 Settings (cyclomatic 45, cognitive 41) · ×1
  • Complex function Settings (cyclomatic 45, cognitive 41) frontend/src/pages/Settings.tsx:42 — Settings has cyclomatic complexity 45 and cognitive complexity 41; 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:921 — 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 ConnectionCard (cyclomatic 37, cognitive 32) · ×1
  • Complex function ConnectionCard (cyclomatic 37, cognitive 32) frontend/src/components/portfolio/ConnectionCenter.tsx:183 — ConnectionCard has cyclomatic complexity 37 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 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 buildPayoffRequest (cyclomatic 33, cognitive 35) · ×1
  • Complex function buildPayoffRequest (cyclomatic 33, cognitive 35) frontend/src/lib/options.ts:373 — buildPayoffRequest has cyclomatic complexity 33 and cognitive complexity 35; 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 ShannonPortfolio (cyclomatic 32, cognitive 27) · ×1
  • Complex function ShannonPortfolio (cyclomatic 32, cognitive 27) frontend/src/components/charts/ShannonPortfolio.tsx:31 — ShannonPortfolio has cyclomatic complexity 32 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 applySwarmEvent (cyclomatic 30, cognitive 31) · ×1
  • Complex function applySwarmEvent (cyclomatic 30, cognitive 31) frontend/src/lib/swarmStatus.ts:209 — applySwarmEvent has cyclomatic complexity 30 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 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 ResearchArtifacts (cyclomatic 26, cognitive 21) · ×1
  • Complex function ResearchArtifacts (cyclomatic 26, cognitive 21) frontend/src/pages/ResearchArtifacts.tsx:80 — ResearchArtifacts has cyclomatic complexity 26 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 (anonymous) (cyclomatic 23, cognitive 31) · ×1
  • Complex function (anonymous) (cyclomatic 23, cognitive 31) frontend/src/pages/Agent.tsx:1401 — (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 submitDataSources (cyclomatic 22, cognitive 22) · ×1
  • Complex function submitDataSources (cyclomatic 22, cognitive 22) frontend/src/pages/Settings.tsx:270 — submitDataSources has cyclomatic complexity 22 and cognitive complexity 22; 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 22, cognitive 20) · ×1
  • Complex function Agent (cyclomatic 22, cognitive 20) frontend/src/pages/Agent.tsx:227 — Agent has cyclomatic complexity 22 and cognitive complexity 20; 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 ResearchLab (cyclomatic 22, cognitive 19) · ×1
  • Complex function ResearchLab (cyclomatic 22, cognitive 19) frontend/src/pages/ResearchLab.tsx:20 — ResearchLab has cyclomatic complexity 22 and cognitive complexity 19; 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:237 — 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.
R2 · Cyclomatic Complexity · Complex function metricSentiment (cyclomatic 21, cognitive 29) · ×1
  • Complex function metricSentiment (cyclomatic 21, cognitive 29) frontend/src/lib/formatters.ts:69 — metricSentiment has cyclomatic complexity 21 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 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 StudioTab (cyclomatic 21, cognitive 18) · ×1
  • Complex function StudioTab (cyclomatic 21, cognitive 18) frontend/src/pages/RunDetail.tsx:622 — StudioTab has cyclomatic complexity 21 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function volatilitySurfaceIssue (cyclomatic 20, cognitive 29) · ×1
  • Complex function volatilitySurfaceIssue (cyclomatic 20, cognitive 29) frontend/src/lib/options.ts:292 — volatilitySurfaceIssue has cyclomatic complexity 20 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 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 errorFromResponse (cyclomatic 20, cognitive 23) · ×1
  • Complex function errorFromResponse (cyclomatic 20, cognitive 23) frontend/src/lib/api.ts:403 — errorFromResponse has cyclomatic complexity 20 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 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 buildVolatilitySurfaceRequest (cyclomatic 20, cognitive 21) · ×1
  • Complex function buildVolatilitySurfaceRequest (cyclomatic 20, cognitive 21) frontend/src/lib/options.ts:258 — buildVolatilitySurfaceRequest has cyclomatic complexity 20 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function verifyWindowsUpdateCandidate (cyclomatic 20, cognitive 19) · ×1
  • Complex function verifyWindowsUpdateCandidate (cyclomatic 20, cognitive 19) desktop/electron/src/update-verification.ts:53 — verifyWindowsUpdateCandidate has cyclomatic complexity 20 and cognitive complexity 19; 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 OptionsChainTable (cyclomatic 20, cognitive 18) · ×1
  • Complex function OptionsChainTable (cyclomatic 20, cognitive 18) frontend/src/components/options/OptionsChainTable.tsx:139 — OptionsChainTable has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function DetailView (cyclomatic 20, cognitive 18) · ×1
  • Complex function DetailView (cyclomatic 20, cognitive 18) frontend/src/pages/AlphaZoo.tsx:457 — DetailView has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CorrelationAnalysis (cyclomatic 20, cognitive 18) · ×1
  • Complex function CorrelationAnalysis (cyclomatic 20, cognitive 18) frontend/src/pages/Correlation.tsx:44 — CorrelationAnalysis has cyclomatic complexity 20 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function SoftwareUpdateSettings (cyclomatic 20, cognitive 17) · ×1
  • Complex function SoftwareUpdateSettings (cyclomatic 20, cognitive 17) frontend/src/components/settings/SoftwareUpdateSettings.tsx:5 — SoftwareUpdateSettings has cyclomatic complexity 20 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 20, cognitive 14) · ×1
  • Complex function (anonymous) (cyclomatic 20, cognitive 14) frontend/src/components/settings/ChannelSettings.tsx:235 — (anonymous) has cyclomatic complexity 20 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function parseHoldings (cyclomatic 19, cognitive 23) · ×1
  • Complex function parseHoldings (cyclomatic 19, cognitive 23) frontend/src/lib/shannon.ts:37 — parseHoldings has cyclomatic complexity 19 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 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 AccountCard (cyclomatic 19, cognitive 18) · ×1
  • Complex function AccountCard (cyclomatic 19, cognitive 18) frontend/src/pages/Portfolio.tsx:547 — AccountCard has cyclomatic complexity 19 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ChartTab (cyclomatic 19, cognitive 16) · ×1
  • Complex function ChartTab (cyclomatic 19, cognitive 16) frontend/src/pages/RunDetail.tsx:825 — ChartTab has cyclomatic complexity 19 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 installUpdate (cyclomatic 19, cognitive 14) · ×1
  • Complex function installUpdate (cyclomatic 19, cognitive 14) desktop/electron/src/main.ts:305 — installUpdate has cyclomatic complexity 19 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 18, cognitive 26) · ×1
  • Complex function (anonymous) (cyclomatic 18, cognitive 26) frontend/src/pages/Agent.tsx:1829 — (anonymous) has cyclomatic complexity 18 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.
R3 · Large Files · frontend/src/lib/api.ts · ×1
  • frontend/src/lib/api.ts: 2208 lines of code frontend/src/lib/api.ts:1 — frontend/src/lib/api.ts has 2208 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: 1858 lines of code frontend/src/pages/Agent.tsx:1 — frontend/src/pages/Agent.tsx has 1858 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: 728 lines of code frontend/src/pages/Settings.tsx:1 — frontend/src/pages/Settings.tsx has 728 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/lib/options.ts · ×1
  • frontend/src/lib/options.ts: 579 lines of code frontend/src/lib/options.ts:1 — frontend/src/lib/options.ts has 579 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: 565 lines of code frontend/src/components/run/PositionsTab.tsx:1 — frontend/src/components/run/PositionsTab.tsx has 565 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/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/lib/swarmStatus.ts · ×1
  • frontend/src/lib/swarmStatus.ts: 492 lines of code frontend/src/lib/swarmStatus.ts:1 — frontend/src/lib/swarmStatus.ts has 492 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/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/pages/ResearchArtifacts.tsx · ×1
  • frontend/src/pages/ResearchArtifacts.tsx: 408 lines of code frontend/src/pages/ResearchArtifacts.tsx:1 — frontend/src/pages/ResearchArtifacts.tsx has 408 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 (29 application, 15 tooling, 112 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 (29 application, 15 tooling, 112 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 (29 application, 15 tooling, 112 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 (~19 LoC) · ×1
  • Dead file (~19 LoC) desktop/electron/src/preload.ts — no import path from any entry point (29 application, 15 tooling, 112 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' frontend/package.json:18 — 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' frontend/package.json:19 — 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 — 144 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • 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 desktop/electron/scripts/build-signed-installer.mjs:94 — `url.protocol !== "https:" || url.username || url.password` appears character-identically in 2 files — desktop/electron/scripts/build-signed-installer.mjs, desktop/electron/src/update.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate 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 16 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/evals/grounding/evidence.py:1009 — `arguments.get("run_dir") or payload.get("run_dir")` appears character-identically in 2 files — agent/evals/grounding/evidence.py, agent/evals/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:758 — `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.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×25
  • Silent fallback default on parse failure agent/backtest/loaders/mt5_loader.py:73 — `_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 REDACTED:490 — `_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/evals/grounding/evidence.py:1310 — `_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/evals/grounding/evidence.py:297 — `_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/evals/grounding/evidence.py:318 — `_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:35 — `_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:170 — `_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/data_gateway/reads.py:28 — `_usable` returns `False` 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/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/llm.py:1628 — `_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.
  • Silent fallback default on parse failure agent/src/tools/backtest_runs_tool.py:51 — `_read_json` 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.
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:1021 — 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:416 — 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:418 — 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:419 — 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:425 — 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:826 — 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:837 — 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:839 — 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 · ×14
  • 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:187 — `_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:395 — `_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:664 — `_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:1362 — `_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:349 — `_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/data_gateway/historical.py:15 — `_available` swallows every exception into `return False` — 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:1430 — `_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 · ×13
  • 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 frontend/src/components/charts/RegimeTimeline.tsx: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/skills/vnpy-export/scripts/cta_template.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 frontend/src/lib/cadence.ts: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.
X4 · Structured logging · Interpolated log message defeats structured logging · ×5
  • Interpolated log message defeats structured logging REDACTED:605 — `info` at line 605 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:615 — `info` at line 615 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:1067 — `exception` at line 1067 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:376 — `warning` at line 376 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:674 — `info` at line 674 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.
D16 · Bus Factor · Off-boarding risk · ×4
  • 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, wiki/scripts/build_alpha_library.py, agent/backtest/options_payoff.py, agent/src/live/runtime/decision_budget.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, 16 significant file(s) lose their only recent owner: agent/src/scheduling/system_jobs.py, agent/src/scheduling/triggers.py, agent/src/live/advisory/__init__.py, agent/src/scheduled_research/internal_dispatch.py, agent/src/channels/token_probe.py, agent/src/memory/consolidation.py, frontend/src/components/charts/OptionsPayoffChart.tsx, agent/src/config/writer.py (+8 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.
D10 · Test Quality · Mock-dominated test · ×2
  • Mock-dominated test: saves $provider.name credentials (desktop=$isDesktop) frontend/src/pages/__tests__/SettingsClaudeCliModels.test.tsx:105 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: 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.
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).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×2
  • Projects may be oversized for their cohesion REDACTED:1 — `agent` (256678 LoC, 2100 module-visible types across 105 directories) overshoots its size bounds. 2 of 5 build unit(s) (Python, npm) overshoot their size bounds, lowering Project Cohesion to 2.0/10. 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.
  • Projects may be oversized for their cohesion frontend/package.json:1 — `frontend` (27590 LoC, 352 module-visible types across 15 directories) overshoots its size bounds. 2 of 5 build unit(s) (Python, npm) overshoot their size bounds, lowering Project Cohesion to 2.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D29 · Static Analysis (SAST) · REDACTED · ×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.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 20 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 (69 single-owned of 821 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; 821 of the 1453 production source files in this repository met that bar). They are anonymized user #5 (2 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)) (+14 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, agent/src/portfolio/extraetf.py, agent/src/live/runtime/reconcile.py, agent/src/trading/connectors/upbit/sdk.py, agent/backtest/engines/vietnam_equity.py, agent/src/skills/options-strategy/example_signal_engine.py, agent/src/live/pending_action.py (+13 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found pyproject.toml:108 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `pyproject.toml` makes this repository a deployable product (line 108).
D30 · Dependency Vulnerabilities · Low CVE · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 13 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, frontend/src/components/charts/RegimeTimeline.tsx, agent/src/skills/vnpy-export/scripts/cta_template.py, agent/src/config/migrate.py (and 5 more) (15 orphaned of 821 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; 821 of the 1453 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.
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 6 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 REDACTED:71 — 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 5/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 (`!`) override strict null checking · ×1
  • Null assertions (`!`) override strict null checking — ~1.1 `!` null assertions per 1k TypeScript source lines — 35 assertion(s) across the 31912 source line(s) of the 134 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. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
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.2.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 --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-156cc28d44cb475c8ea2eafe16f154b5/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-156cc28d44cb475c8ea2eafe16f154b5/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=2814" --report-format json --report-path /tmp/watchdog-gitleaks-156cc28d44cb475c8ea2eafe16f154b5/history-2.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-2.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-156cc28d44cb475c8ea2eafe16f154b5/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .19artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .15artifacts/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/** .0artifacts/raw/trivy-fs.json

Run 01a1e297-cf76-7ca9-9d6e-d1650bcc3d01 · 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