Public report of oficcejo/tradingagents-cn-plus, published 17 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 reportMeasured 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, 17 November 2026, 17:51 UTC · Survey ID cd_32c189bf85bc4b1eac45e9bae76edef7
oficcejo/tradingagents-cn-plus
Measured 17 November 2026, 17:51 UTC, at code version d776b06
Supply-chain provenance & signing is not measured: Supply-chain provenance is not scored (this pipeline releases no artifact), but its build steps or GitHub Actions workflows have integrity defects, or nothing watches its dependency set for published advisories.
CAI scoreAt risk
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 medium codebase: 58,724 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 0.6 person-years · Weakest lens: Maturity, 35.6
Findings by how serious they are
56 critical820 serious130 minor
14 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
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 17:51 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
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 ▸
49of 49 dimensions measured by tools.
999of 1006 findings point to an exact file and line, so you can open each one in the code. The other 7 concern the repository as a whole, such as missing documentation.
49dimensions across 7 lenses, read from 58,724 lines of product code in 2 projects.
oficcejo/tradingagents-cn-plus is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back because the documentation refers to links that don't exist and the project keeps no record of its design decisions. It scores 46.8 out of 100, which the At risk rating leaves unchanged. We judged it as a preview release, against a lower bar.
Maturity, at 35.6, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 10.0 points. Bringing the documentation in line with the code comes next, worth about 7.3 points. Raising Maturity to 62 would lift the score to about 54.7.
Twenty-eight known security holes in the packages the code depends on can be used by attackers. Fifteen passwords or keys are open to anyone who can read the repository, and six pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Updating the vulnerable packages, replacing each exposed password or key and pinning each tool to an exact version would close these risks. The four unsafe settings in infrastructure or container files need changing to safe values. The pipeline step that installs packages without pinning their versions needs the packages it installs pinned to exact versions. The package under a licence on your banned list needs replacing, or clearing with your legal team.
The product code is 58,724 lines, about €84,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 forThe 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.
If Maturity rose from 35.6 to 62, the lowest score rated Strong, the score would rise from 46.8 to about 54.7.
Code composition: what the lines of code are
Product code 63%Tests 37%
Rebuild cost: about €84,000 · Estimate
Cost to rebuild
€28,000 to €140,000, for 466 to 1,479 hours of work, about 0.6 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 47. 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.
Size
Medium: 58,724 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pyproject.toml.
Raises the score by about 10.0 points · Low effort · ADR Quality
2
Reconcile the README with reality: docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist; docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist; docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist; docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist; docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist.
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 €84,000 to build again, about 0.6 person-years of work. Its weakest lens is Maturity, at 35.6 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 10.0 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
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.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 17% on every change. The history of the code shows how much it changes: about 1,481 lines over the last 90 days, which is about 6,006 lines a year. At that pace, the extra work comes to an estimated 1.1 to 6.7 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.
122 modules, with 42 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; 82 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.
docs.LLM_ADAPTER_TEMPLATE uses tradingagents.llm_adapters.openai_compatible_base, so a change to tradingagents.llm_adapters.openai_compatible_base can break docs.LLM_ADAPTER_TEMPLATE, while a change to docs.LLM_ADAPTER_TEMPLATE can't break tradingagents.llm_adapters.openai_compatible_base.
Position
Below the diagonal: docs.LLM_ADAPTER_TEMPLATE uses a module listed above it, which is the healthy direction.
scripts uses scripts.unified_data_manager, so a change to scripts.unified_data_manager can break scripts, while a change to scripts can't break scripts.unified_data_manager.
Position
Below the diagonal: scripts uses a module listed above it, which is the healthy direction.
scripts.development uses scripts.development.adaptive_cache_manager, so a change to scripts.development.adaptive_cache_manager can break scripts.development, while a change to scripts.development can't break scripts.development.adaptive_cache_manager.
Position
Below the diagonal: scripts.development uses a module listed above it, which is the healthy direction.
scripts.validation uses scripts.validation.smart_config, so a change to scripts.validation.smart_config can break scripts.validation, while a change to scripts.validation can't break scripts.validation.smart_config.
Position
Below the diagonal: scripts.validation uses a module listed above it, which is the healthy direction.
tradingagents.config uses tradingagents.config.database_manager, so a change to tradingagents.config.database_manager can break tradingagents.config, while a change to tradingagents.config can't break tradingagents.config.database_manager.
Position
Below the diagonal: tradingagents.config uses a module listed above it, which is the healthy direction.
tradingagents.config uses tradingagents.config.tushare_config, so a change to tradingagents.config.tushare_config can break tradingagents.config, while a change to tradingagents.config can't break tradingagents.config.tushare_config.
Position
Below the diagonal: tradingagents.config uses a module listed above it, which is the healthy direction.
tradingagents.config.mongodb_storage uses tradingagents.config.config_manager, so a change to tradingagents.config.config_manager can break tradingagents.config.mongodb_storage, while a change to tradingagents.config.mongodb_storage can't break tradingagents.config.config_manager.
Position
Below the diagonal: tradingagents.config.mongodb_storage uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.adaptive_cache, so a change to tradingagents.dataflows.adaptive_cache can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.adaptive_cache.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.akshare_utils, so a change to tradingagents.dataflows.akshare_utils can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.akshare_utils.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.cache_manager, so a change to tradingagents.dataflows.cache_manager can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.cache_manager.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.data_source_manager, so a change to tradingagents.dataflows.data_source_manager can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.data_source_manager.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.db_cache_manager, so a change to tradingagents.dataflows.db_cache_manager can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.db_cache_manager.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.hk_stock_utils, so a change to tradingagents.dataflows.hk_stock_utils can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.hk_stock_utils.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.improved_hk_utils, so a change to tradingagents.dataflows.improved_hk_utils can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.improved_hk_utils.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.integrated_cache, so a change to tradingagents.dataflows.integrated_cache can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.integrated_cache.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.optimized_china_data, so a change to tradingagents.dataflows.optimized_china_data can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.optimized_china_data.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.optimized_us_data, so a change to tradingagents.dataflows.optimized_us_data can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.optimized_us_data.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.stock_data_service, so a change to tradingagents.dataflows.stock_data_service can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.stock_data_service.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.tdx_utils, so a change to tradingagents.dataflows.tdx_utils can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.tdx_utils.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.tushare_adapter, so a change to tradingagents.dataflows.tushare_adapter can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.tushare_adapter.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.dataflows uses tradingagents.dataflows.tushare_utils, so a change to tradingagents.dataflows.tushare_utils can break tradingagents.dataflows, while a change to tradingagents.dataflows can't break tradingagents.dataflows.tushare_utils.
Position
Below the diagonal: tradingagents.dataflows uses a module listed above it, which is the healthy direction.
tradingagents.graph.conditional_logic uses tradingagents.agents.utils.agent_states, so a change to tradingagents.agents.utils.agent_states can break tradingagents.graph.conditional_logic, while a change to tradingagents.graph.conditional_logic can't break tradingagents.agents.utils.agent_states.
Position
Below the diagonal: tradingagents.graph.conditional_logic uses a module listed above it, which is the healthy direction.
tradingagents.llm uses tradingagents.llm.deepseek_adapter, so a change to tradingagents.llm.deepseek_adapter can break tradingagents.llm, while a change to tradingagents.llm can't break tradingagents.llm.deepseek_adapter.
Position
Below the diagonal: tradingagents.llm uses a module listed above it, which is the healthy direction.
tradingagents.llm_adapters uses tradingagents.llm_adapters.dashscope_adapter, so a change to tradingagents.llm_adapters.dashscope_adapter can break tradingagents.llm_adapters, while a change to tradingagents.llm_adapters can't break tradingagents.llm_adapters.dashscope_adapter.
Position
Below the diagonal: tradingagents.llm_adapters uses a module listed above it, which is the healthy direction.
tradingagents.llm_adapters uses tradingagents.llm_adapters.openai_compatible_base, so a change to tradingagents.llm_adapters.openai_compatible_base can break tradingagents.llm_adapters, while a change to tradingagents.llm_adapters can't break tradingagents.llm_adapters.openai_compatible_base.
Position
Below the diagonal: tradingagents.llm_adapters uses a module listed above it, which is the healthy direction.
tradingagents.utils.enhanced_news_filter uses tradingagents.utils.news_filter, so a change to tradingagents.utils.news_filter can break tradingagents.utils.enhanced_news_filter, while a change to tradingagents.utils.enhanced_news_filter can't break tradingagents.utils.news_filter.
Position
Below the diagonal: tradingagents.utils.enhanced_news_filter uses a module listed above it, which is the healthy direction.
tradingagents.graph.setup uses tradingagents.agents.utils.agent_utils, so a change to tradingagents.agents.utils.agent_utils can break tradingagents.graph.setup, while a change to tradingagents.graph.setup can't break tradingagents.agents.utils.agent_utils.
Position
Below the diagonal: tradingagents.graph.setup uses a module listed above it, which is the healthy direction.
tradingagents.graph.setup uses tradingagents.graph.conditional_logic, so a change to tradingagents.graph.conditional_logic can break tradingagents.graph.setup, while a change to tradingagents.graph.setup can't break tradingagents.graph.conditional_logic.
Position
Below the diagonal: tradingagents.graph.setup uses a module listed above it, which is the healthy direction.
tradingagents.utils uses tradingagents.utils.news_filter, so a change to tradingagents.utils.news_filter can break tradingagents.utils, while a change to tradingagents.utils can't break tradingagents.utils.news_filter.
Position
Below the diagonal: tradingagents.utils uses a module listed above it, which is the healthy direction.
tradingagents.utils uses tradingagents.utils.enhanced_news_filter, so a change to tradingagents.utils.enhanced_news_filter can break tradingagents.utils, while a change to tradingagents.utils can't break tradingagents.utils.enhanced_news_filter.
Position
Below the diagonal: tradingagents.utils uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 53.7 · Adequate · gated by D2, X4 ·
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 category
Findings
Severity
A03:2025 — Software Supply Chain Failures
41
High / Critical
A05:2025 — Injection
25
High / Critical
A07:2025 — Authentication Failures
15
High / Critical
A02:2025 — Security Misconfiguration
9
High / Critical
Roadmap
Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pyproject.toml; Reconcile the README with reality: docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist; docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist; docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist; docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist; docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist; Expand the README with getting-started, architecture overview and a project map.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pyproject.toml.
Reconcile the README with reality: docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist; docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist; docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist; docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist; docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist.
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 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.
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 — 56
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 — 820
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 130
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 14
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 49 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 — 49 dimensions across the health lenses
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
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, 999 of 1006 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.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
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.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
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.
D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 39 shipped Python distribution(s) across 2 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Git history depth insufficient — this repository has 6 commit(s), too few for a reliable trend signal. The clone is complete, so there is no deeper history to fetch: the signal returns as the project accumulates history.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 6 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
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.
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 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D24 compares a comment's words with the identifiers, literals and constructs of the code it annotates, using English function-word and rationale lexicons. Comments in another script or language were left unread rather than counted as clean.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D34 Knowledge Freshness — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Too few commits to judge knowledge freshness (6 commit(s) sampled).
D35 Change Coupling — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Git history depth insufficient — this repository has 6 commit(s), too few for a reliable change-coupling signal. The clone is complete, so there is no deeper history to fetch: the signal returns as the project accumulates history.
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 (REDACTED). compose up failed (exit 14 — a file the compose project references is missing) — env file .env not found: stat .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. 'redis' is imported (web/utils/async_progress_tracker.py:157), 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. 'redis' is imported (web/utils/async_progress_tracker.py:157), 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. 'redis' is imported (web/utils/async_progress_tracker.py:157), 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, Rust and Java source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Java was found, and this repository's Python 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 no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 reads a prose claim (a path, a setting, a variable, a route, a version, a project, an install, a bare project name in a command) only in text identified as English: the cues that tell a claim from an absence, the past, a plan or an example are an English lexicon, and on other text they would let a false claim through. Links, image targets, fenced commands with an explicit path or a package-manager script, and env-fence variables are checked in every language. 'und' is text the identifier could not name (too short, mixed script, no function words).
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P1 CI/CD gates — 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. A CI pipeline exists and the word "test" appears, but no explicit test-runner invocation (your stack's test command, or a test job) was matched — so either the gate runs tests through a step this pass could not recognise, or "test" is incidental here (a path, "latest", a reporter). Which of the two it is cannot be settled from this dimension's evidence; the coverage dimensions report whether a suite exists at all. You can widen what we reach: name the test runner explicitly in the pipeline step (your stack's test command, or a job named for the suite) so the gate is unambiguous to a reader and to this pass.
S1 Web-Security Posture — 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 web-security 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 web-security controls.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust and Elixir source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust or Elixir was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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. 39 further occurrence(s) are not listed individually; the score already reflects all 79.
X4 Structured logging — 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. 456 further occurrence(s) are not listed individually; the score already reflects all 496.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
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.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
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.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
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.
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.
+ 52 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with app.main (cyclomatic 85), sidebar.render_sidebar (cyclomatic 85), main.run_analysis (cyclomatic 77). — 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 5 together lifts Cyclomatic Complexity from 4.1 to about 4.9/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 106 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 15 bodies over 60 down to 60 or less in Cognitive Complexity — start with app.render_batch_analysis_page (cognitive 188), main.run_analysis (cognitive 185), app.main (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 15 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.
Do you agree with this assessment?
D3 · God Classes9.1 / 10Stronggated by 11 serious findings✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
11 over-large unit(s) detected — types, modules or files that carry too much.
FileTooLong: cli/main.py · ×11cli/main.py
What to do
Resolve the 11 FileTooLong finding(s) in God Classes — start with main.py, analysis_results.py, app.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.
Do you agree with this assessment?
D4 · Code Duplication4.2 / 10Weak✓ 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.
193 duplicated block group(s) detected. 14.5 % of the production lines (8,512 of 58,724) are in a reported copy. A further 65 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 58 of the 258 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.
+ 144 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 8 Duplicated block (18 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), REDACTED, interface.py. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 8 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with main.py, interface.py, data_source_manager.py. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 7 Duplicated block (21 lines × 2) finding(s) in Code Duplication — start with enhanced_news_filter.py, analysis_results.py, operation_logs.py. — One of this dimension's main actionable groups (7 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with main.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D8 · Code Coverage2.9 / 10Weak✓ Tool-verified
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
Line coverage 3.0% — 108 file(s) below 50%. Measured from the Python suite (repository root: `coverage run -m pytest`, the 3 run(s) test reliability made). Taken over 3 runs of the suite: a line counts as covered only when every run executed it.
Low coverage: cli/main.py · ×108cli/main.py:1
What to do
Resolve the 108 Low coverage finding(s) in Code Coverage — start with __init__.py (4), main.py (2), utils.py (2). — One of this dimension's main actionable groups (108 warning-level).
Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests pass reliably, with no flakiness.
Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.
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.
7 secret(s) detected. 6 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.
REDACTED
What to do
Resolve the 15 Leaked secret finding(s) in Secret Scanning — start with REDACTED (5), REDACTED (4), REDACTED (2). — One of this dimension's main actionable groups (15 issue-level).
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
1 of 228 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 39 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (189 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.
Banned license: backtrader
What to do
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.
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.
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.
194 deducted task-comment markers across 58724 LoC (0.3/KLoC) → score 9.4. 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.
Resolve the 193 TodoComment finding(s) in Explicit Debt — start with optimized_us_data.py (46), fundamentals_analyst.py (39), market_analyst.py (30). — One of this dimension's main actionable groups (193 warning-level).
Resolve the 1 XxxComment finding(s) in Explicit Debt — start with stock_validator.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
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.
1 of 2 build units (Python) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesionpyproject.toml:1
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with pyproject.toml. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
81 % of calls cross a namespace and 0 % go through an interface, but 87 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
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.
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).
25 finding(s): 0 critical, 7 high, 17 medium, 1 low. 6 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. 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
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (9 warning-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
No action in Static Analysis (SAST) — all 6 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (6 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 21 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (21). — One of this dimension's main actionable groups (21 issue-level).
Resolve the 6 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).
Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 4 High IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 4 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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.
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.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 39 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.
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.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — reports/batch_analysis_report_batch_3e08ecf5_20250924_172010_20250924_173249.html:3
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — reports/batch_analysis_report_batch_3e08ecf5_20250924_172010_20250924_173249.html:3
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.
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.
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.
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.
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.
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.
The root README is 3 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers. — README.md:1
What to do
Expand the README with getting-started, architecture overview and a project map.
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
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.
Most of the production code is in directories of its own, but 7 application file(s) sit at the repository root beside the build and tooling files (`demo_batch_analysis.py`, `main.py`, `start_web.py`, `test_batch_analysis.py`, `test_fix.py` and 2 more).
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.
docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:24
docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:25
docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:26
docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:27
docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:28
docs/README.md links to `./architecture/graph-structure.md`, but `docs/architecture/graph-structure.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:29
docs/README.md links to `./architecture/configuration-optimization.md`, but `docs/architecture/configuration-optimization.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:30
docs/README.md links to `./agents/analysts.md`, but `docs/agents/analysts.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:33
docs/README.md links to `./agents/researchers.md`, but `docs/agents/researchers.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:34
docs/README.md links to `./agents/trader.md`, but `docs/agents/trader.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:35
docs/README.md links to `./agents/risk-management.md`, but `docs/agents/risk-management.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:36
docs/README.md links to `./agents/managers.md`, but `docs/agents/managers.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:37
docs/README.md links to `./features/multi-llm-integration.md`, but `docs/features/multi-llm-integration.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:49
docs/README.md links to `./features/model-persistence.md`, but `docs/features/model-persistence.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:50
docs/README.md links to `./configuration/openrouter-config.md`, but `docs/configuration/openrouter-config.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:59
docs/README.md links to `./development/dev-setup.md`, but `docs/development/dev-setup.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:75
docs/README.md links to `./development/code-structure.md`, but `docs/development/code-structure.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:76
docs/README.md links to `./development/extending.md`, but `docs/development/extending.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:77
docs/README.md links to `./development/testing.md`, but `docs/development/testing.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:78
docs/README.md links to `./api/core-api.md`, but `docs/api/core-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:87
docs/README.md links to `./api/agents-api.md`, but `docs/api/agents-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:88
docs/README.md links to `./api/data-api.md`, but `docs/api/data-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:89
docs/README.md links to `./guides/NEWS_FILTERING_USER_GUIDE.md`, but `docs/guides/NEWS_FILTERING_USER_GUIDE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:92
docs/README.md links to `./guides/multi-llm-usage-guide.md`, but `docs/guides/multi-llm-usage-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:93
docs/README.md links to `./guides/model-persistence-guide.md`, but `docs/guides/model-persistence-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:94
docs/guides/README.md links to `./us-stock-analysis-guide.md`, but `docs/guides/us-stock-analysis-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:23
docs/guides/README.md links to `./hk-stock-analysis-guide.md`, but `docs/guides/hk-stock-analysis-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:24
docs/guides/README.md links to `../development/api-development-guide.md`, but `docs/development/api-development-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:27
docs/guides/README.md links to `./cost-control-guide.md`, but `docs/guides/cost-control-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:32
docs/guides/README.md links to `./data-source-guide.md`, but `docs/guides/data-source-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:33
docs/guides/README.md links to `./model-selection-guide.md`, but `docs/guides/model-selection-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/guides/README.md:34
What to do
Reconcile the README with reality: docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist; docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist; docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist; docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist; docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist.
Do you agree with this assessment?
P1 · CI/CD gates6.5 / 10Strong✓ Tool-verified
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.
A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.
What to do
Run the test suite in CI via an explicit runner step (`pytest` for the toolchain this pipeline already uses) and gate merges on it.
Add an explicit build step to your CI pipeline — your stack's own build command, or, if the pipeline delegates to a task runner, a build task that runner executes in CI — so every change is built before merge.
Do you agree with this assessment?
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.
Do you agree with this assessment?
P2 · Observability7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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 1 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.
`pyproject.toml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — pyproject.toml:11
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.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
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.
What to do
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
Do you agree with this assessment?
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).
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.
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.
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.
Do you agree with this assessment?
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.
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.
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.
`debug` at line 289 is called with an argument built by `[a[0] for a in selected_analysts]` (line 289), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — web/components/analysis_form.py:289
`debug` at line 268 is called with an argument built by `[a[0] for a in selected_analysts]` (line 268), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — web/components/batch_analysis_form.py:268
`debug` at line 248 is called with an argument built by `list(decision.keys())` (line 248), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — web/components/results_display.py:248
`debug` at line 277 is called with an argument built by `[tool.name for tool in tools]` (line 277), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:277
`debug` at line 282 is called with an argument built by `[tool.name for tool in tools]` (line 282), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:282
`debug` at line 354 is called with an argument built by `list(main_indicators.columns)` (line 354), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — REDACTED:354
`debug` at line 195 is called with an argument built by `list(str(symbol))` (line 195), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — tradingagents/dataflows/optimized_china_data.py:195
`debug` at line 397 is called with an argument built by `list(str(symbol))` (line 397), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — tradingagents/dataflows/optimized_china_data.py:397
`debug` at line 63 is called with an argument built by `[attr for attr in dir(result) if not attr.startswith("…")]` (line 63), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — tradingagents/agents/utils/google_tool_handler.py:63
`debug` at line 74 is called with an argument built by `[attr for attr in dir(result) if not attr.startswith("…")]` (line 74), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — tradingagents/agents/utils/google_tool_handler.py:74
`debug` at line 350 is called with an argument built by `[attr for attr in dir(final_result) if not attr.startswith("…")]` (line 350), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — tradingagents/agents/utils/google_tool_handler.py:350
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
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.
Do you agree with this assessment?
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.
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.
`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. (×9) — web/app.py:1905, web/utils/async_progress_tracker.py:720, web/utils/file_session_manager.py:80, …
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. (×15) — web/utils/analysis_runner.py:519, web/utils/batch_analysis_runner.py:132, web/utils/batch_analysis_runner.py:167, …
`except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×16) — web/utils/file_session_manager.py:40, web/utils/user_activity_logger.py:93, web/modules/config_management.py:349, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
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.
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 369 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. — web/app.py:369
`warning` at line 372 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. — web/app.py:372
`info` at line 385 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. — web/app.py:385
`warning` at line 395 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. — web/app.py:395
`warning` at line 400 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. — web/app.py:400
`warning` at line 415 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. — web/app.py:415
`info` at line 422 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. — web/app.py:422
`info` at line 423 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. — web/app.py:423
`warning` at line 437 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. — web/app.py:437
`info` at line 463 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. — web/app.py:463
`info` at line 464 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. — web/app.py:464
`info` at line 470 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. — web/app.py:470
`warning` at line 484 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. — web/app.py:484
`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. — web/app.py:615
`warning` at line 617 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. — web/app.py:617
`warning` at line 923 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. — web/app.py:923
`debug` at line 1149 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1149
`debug` at line 1150 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1150
`debug` at line 1151 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1151
`warning` at line 1182 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. — web/app.py:1182
`info` at line 1290 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. — web/app.py:1290
`warning` at line 1292 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. — web/app.py:1292
`error` at line 1295 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.error("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.error("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1295
`info` at line 1297 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. — web/app.py:1297
`info` at line 1315 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. — web/app.py:1315
`error` at line 1318 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.error("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.error("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1318
`error` at line 1320 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.error("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.error("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1320
`info` at line 1326 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. — web/app.py:1326
`info` at line 1337 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. — web/app.py:1337
`info` at line 1364 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. — web/app.py:1364
`info` at line 1403 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. — web/app.py:1403
`info` at line 1425 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. — web/app.py:1425
`warning` at line 1427 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. — web/app.py:1427
`error` at line 1430 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.error("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.error("order moved", order_id=order_id, status=status)` with structlog. — web/app.py:1430
`warning` at line 1444 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. — web/app.py:1444
`info` at line 1475 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. — web/app.py:1475
`info` at line 1476 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. — web/app.py:1476
`info` at line 1477 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. — web/app.py:1477
`info` at line 1478 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. — web/app.py:1478
`info` at line 1479 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. — web/app.py:1479
Statically assessed 8 of 55 WCAG 2.2 Level A/AA success criteria (15%; ≈16% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 47 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).
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.
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.
D36 Supply-chain Provenance & Signing — 1 observation(s) recorded · The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
X10 Duplicated predicate — 32 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 4 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 'redis' (web/utils/async_progress_tracker.py:157) 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 'redis' (web/utils/async_progress_tracker.py:157) 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 'redis' (web/utils/async_progress_tracker.py:157) 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 — 62 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
AC2 Forms & labels — No form control/button found in the parsed markup — AC2 not applicable here.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
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.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — no interface, protocol or abstract type declares an operation an implementer must write
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 .env not found: stat .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.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository registers no route and starts no server another machine can reach (no Flask/FastAPI/Starlette route, Django urlpatterns or class-based view, Tornado handler). Access control is therefore N/A here — a library or command-line tool is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
D10 Test Quality — ~34613 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
D16 Bus Factor — single-contributor repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D19 Documentation Quality — No runnable or published unit to look for an example in, and no multi-project root README to look for a map in; the other documentation kinds are withheld (see the gaps), so documentation quality is not applicable here.
D21 Naming Consistency — Naming consistency does not read html yet; not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
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. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — 33 of 33 comment blocks were not judged (33 in a non-Latin script): redundancy is judged by word overlap with the code's identifiers, which cannot be measured across languages.
D25 ADR Conformance — no ADRs to check
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D34 Knowledge Freshness — too few commits to judge knowledge freshness
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
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
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (1 value object(s))
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, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 116 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.
S1 Web-Security Posture — Not assessed: these web-security 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 web-security 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.
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
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.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
<html> without a lang reports/batch_analysis_report_batch_3e08ecf5_20250924_172010_20250924_173249.html:3— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
Banned license: backtrader — `backtrader` 1.9.78.123 is published on PyPI under `GPL-3.0-or-later`, 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.
TodoComment upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:29— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:61— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:63— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:71— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:86— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:90— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:107— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:113— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:121— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:130— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:136— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:151— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:155— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:161— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:166— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:171— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:178— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:211— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:241— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:248— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:253— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:257— # TODO: Add English comment — 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 upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:311— # TODO: Add English comment — 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 REDACTED:55— # TODO: Add English comment — 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 REDACTED:66— # TODO: Add English comment — 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.
Swallowed exception (caught, then discarded) web/app.py:1905— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/async_progress_tracker.py:720— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/file_session_manager.py:40— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/file_session_manager.py:80— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/license_manager.py:20— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/license_manager.py:43— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/smart_session_manager.py:31— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/utils/user_activity_logger.py:93— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/modules/cache_management.py:281— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/modules/config_management.py:349— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/modules/member_management.py:9— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/modules/token_statistics.py:381— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/analysis_results.py:67— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/analysis_results.py:78— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/analysis_results.py:88— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/analysis_results.py:99— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/analysis_results.py:232— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/login.py:78— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:102— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:136— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:239— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:243— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:291— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:294— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) web/components/operation_logs.py:379— `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (empty catch) web/utils/analysis_runner.py:519— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:132— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:167— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:215— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:249— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:275— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:305— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/batch_analysis_runner.py:354— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/docker_pdf_adapter.py: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) web/utils/docker_pdf_adapter.py: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) web/utils/file_session_manager.py:242— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/report_exporter.py:521— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/smart_session_manager.py:97— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/smart_session_manager.py:104— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) web/utils/smart_session_manager.py:162— 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.
D30 · Dependency Vulnerabilities· Medium CVE · ×13
FileTooLong: cli/main.py cli/main.py— FileTooLong — 1362 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 862 over it, 2.72× 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: components/analysis_results.py web/components/analysis_results.py— FileTooLong — 1119 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 619 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: web/app.py web/app.py— FileTooLong — 1047 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 547 over it, 2.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: dataflows/interface.py tradingagents/dataflows/interface.py— FileTooLong — 942 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 442 over it, 1.88× 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: dataflows/optimized_china_data.py tradingagents/dataflows/optimized_china_data.py— FileTooLong — 776 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 276 over it, 1.55× 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: utils/analysis_runner.py web/utils/analysis_runner.py— FileTooLong — 761 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 261 over it, 1.52× 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: dataflows/realtime_news_utils.py tradingagents/dataflows/realtime_news_utils.py— FileTooLong — 667 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 167 over it, 1.33× 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: dataflows/data_source_manager.py tradingagents/dataflows/data_source_manager.py— FileTooLong — 583 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 83 over it, 1.17× 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: utils/async_progress_tracker.py web/utils/async_progress_tracker.py— FileTooLong — 520 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 20 over it, 1.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: utils/stock_validator.py tradingagents/utils/stock_validator.py— FileTooLong — 511 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 11 over it, 1.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: dataflows/tdx_utils.py tradingagents/dataflows/tdx_utils.py— FileTooLong — 508 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 8 over it, 1.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.
Duplicated block (18 lines × 2) REDACTED:188— REDACTED:188-205 | REDACTED:116-133 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) REDACTED:335— REDACTED:335-352 | REDACTED:245-262 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) REDACTED:495— REDACTED:495-512 | REDACTED:495-512 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) tradingagents/dataflows/interface.py:395— tradingagents/dataflows/interface.py:395-412 | tradingagents/dataflows/interface.py:448-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tradingagents/dataflows/interface.py:448` 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.
Duplicated block (18 lines × 2) tradingagents/llm_adapters/dashscope_openai_adapter.py:220— tradingagents/llm_adapters/dashscope_openai_adapter.py:220-237 | tradingagents/llm_adapters/google_openai_adapter.py:314-331 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (18 lines × 2) tradingagents/utils/stock_validator.py:465— tradingagents/utils/stock_validator.py:465-482 | tradingagents/utils/stock_validator.py:528-545 — both copies are in the same file, so extract the 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 `tradingagents/utils/stock_validator.py:465` 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 (18 lines × 2) upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:242— upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:242-259 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:198-215 — before extracting anything, compare `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py` and `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) examples/dashscope_examples/demo_dashscope.py:113— examples/dashscope_examples/demo_dashscope.py:113-130 | examples/dashscope_examples/demo_dashscope_no_memory.py:104-121 — before extracting anything, compare `examples/dashscope_examples/demo_dashscope.py` and `examples/dashscope_examples/demo_dashscope_no_memory.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `examples/dashscope_examples/demo_dashscope.py:112` calls `info` and `examples/dashscope_examples/demo_dashscope_no_memory.py:103` 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) cli/main.py:1109— cli/main.py:1109-1115 | cli/main.py:1120-1126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) tradingagents/dataflows/interface.py:1471— tradingagents/dataflows/interface.py:1471-1477 | tradingagents/dataflows/interface.py:1484-1490 — both copies are in the same file, so extract the 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 (7 lines × 2) tradingagents/dataflows/data_source_manager.py:731— tradingagents/dataflows/data_source_manager.py:731-737 | tradingagents/dataflows/data_source_manager.py:780-786 — both copies are in the same file, so extract the 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 (7 lines × 2) examples/tushare_demo.py:197— examples/tushare_demo.py:197-203 | examples/tushare_demo.py:209-215 — both copies are in the same file, so extract the block into 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) scripts/analyze_data_calls.py:355— scripts/analyze_data_calls.py:355-361 | scripts/log_analyzer.py:346-352 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) scripts/get_container_logs.py:160— scripts/get_container_logs.py:160-166 | scripts/get_main_branch_logs.py:126-132 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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, `scripts/get_main_branch_logs.py:135` calls `split`, `encode` and `scripts/get_container_logs.py:167` 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) scripts/setup/quick_install.py:51— scripts/setup/quick_install.py:51-57 | scripts/setup/quick_install.py:73-79 — both copies are in the same file, so extract the 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 (7 lines × 2) scripts/user_activity_manager.py:156— scripts/user_activity_manager.py:156-162 | scripts/user_activity_manager.py:168-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) tradingagents/utils/enhanced_news_filter.py:257— tradingagents/utils/enhanced_news_filter.py:257-277 | tradingagents/utils/news_filter.py:135-155 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `min_score` to `float = 40` in one and `float = 30` 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 (21 lines × 2) web/components/analysis_results.py:919— web/components/analysis_results.py:919-939 | web/components/operation_logs.py:452-472 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21 lines × 2) web/components/operation_logs.py:260— web/components/operation_logs.py:260-280 | web/components/user_activity_dashboard.py:117-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (21 lines × 2) web/utils/async_progress_tracker.py:390— web/utils/async_progress_tracker.py:390-410 | web/utils/progress_tracker.py:166-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (21 lines × 2) scripts/convert_prints_to_logs.py:284— scripts/convert_prints_to_logs.py:284-304 | scripts/fix_logging_imports.py:212-232 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (21 lines × 2) scripts/install_pandoc.py:67— scripts/install_pandoc.py:67-87 | scripts/install_pdf_tools.py:51-71 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 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 (21 lines × 2) scripts/setup/quick_install.py:109— scripts/setup/quick_install.py:109-129 | scripts/setup/quick_install.py:190-210 — both copies are in the same file, so extract the 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) cli/main.py:359— cli/main.py:359-371 | cli/main.py:376-388 — both copies are in the same file, so extract the block into 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) tradingagents/agents/utils/memory.py:160— tradingagents/agents/utils/memory.py:160-172 | tradingagents/agents/utils/memory.py:190-203 — both copies are in the same file, so extract the 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, `tradingagents/agents/utils/memory.py:186` calls `getenv`, `lower` and `tradingagents/agents/utils/memory.py:157` 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 (13 lines × 2) tradingagents/dataflows/realtime_news_utils.py:177— tradingagents/dataflows/realtime_news_utils.py:177-189 | tradingagents/dataflows/realtime_news_utils.py:228-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) tradingagents/dataflows/realtime_news_utils.py:766— tradingagents/dataflows/realtime_news_utils.py:766-778 | tradingagents/dataflows/realtime_news_utils.py:867-879 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) tradingagents/utils/stock_validator.py:298— tradingagents/utils/stock_validator.py:298-310 | tradingagents/utils/stock_validator.py:433-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 (13 lines × 2) web/components/analysis_results.py:372— web/components/analysis_results.py:372-384 | web/components/operation_logs.py:179-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `web/components/analysis_results.py:372` 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 (13 lines × 2) web/components/batch_progress_display.py:273— web/components/batch_progress_display.py:273-285 | web/components/batch_results_display.py:263-275 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `web/components/batch_progress_display.py:273` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) tradingagents/agents/researchers/bull_researcher.py:26— tradingagents/agents/researchers/bull_researcher.py:26-35 | tradingagents/agents/trader/trader.py:20-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tradingagents/agents/researchers/bull_researcher.py:25` calls `get` and `tradingagents/agents/trader/trader.py:17` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) REDACTED:296— REDACTED:296-305 | REDACTED:209-218 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:306` calls `mkdir` and `REDACTED:219` 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 (10 lines × 2) tradingagents/tools/unified_news_tool.py:116— tradingagents/tools/unified_news_tool.py:116-125 | tradingagents/tools/unified_news_tool.py:208-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tradingagents/tools/unified_news_tool.py:115` calls `warning` and `tradingagents/tools/unified_news_tool.py:207` 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 (10 lines × 2) web/modules/cache_management.py:172— web/modules/cache_management.py:172-181 | web/modules/cache_management.py:192-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) scripts/get_container_logs.py:13— scripts/get_container_logs.py:13-22 | scripts/get_main_branch_logs.py:13-22 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) scripts/get_container_logs.py:72— scripts/get_container_logs.py:72-81 | scripts/get_main_branch_logs.py:99-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) scripts/user_activity_manager.py:146— scripts/user_activity_manager.py:146-155 | scripts/user_activity_manager.py:158-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) tradingagents/agents/managers/research_manager.py:10— tradingagents/agents/managers/research_manager.py:10-53 | tradingagents/agents/managers/risk_manager.py:10-49 | tradingagents/agents/researchers/bear_researcher.py:11-86 | tradingagents/agents/researchers/bull_researcher.py:11-95 — 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) REDACTED:177— REDACTED:177-185 | REDACTED:165-171 | REDACTED:105-113 | REDACTED:165-171 — 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) REDACTED:357— REDACTED:357-411 | REDACTED:513-552 | REDACTED:267-321 | REDACTED:396-435 — 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) tradingagents/dataflows/interface.py:713— tradingagents/dataflows/interface.py:713-749 | tradingagents/dataflows/optimized_us_data.py:184-232 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:149-197 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:149-197 — 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) web/components/async_progress_display.py:64— web/components/async_progress_display.py:64-160 | web/components/async_progress_display.py:194-303 | web/components/async_progress_display.py:307-448 | web/components/async_progress_display.py:464-610 — 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) web/utils/file_session_manager.py:211— web/utils/file_session_manager.py:211-249 | REDACTED:256-285 | REDACTED:154-183 | web/utils/smart_session_manager.py:137-169 — 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.
Duplicated block (20 lines × 2) tradingagents/agents/researchers/bear_researcher.py:12— tradingagents/agents/researchers/bear_researcher.py:12-31 | tradingagents/agents/researchers/bull_researcher.py:14-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 both call sites, so a change lands once.
Duplicated block (20 lines × 2) REDACTED:104— REDACTED:104-123 | REDACTED:104-123 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) web/components/async_progress_display.py:98— web/components/async_progress_display.py:98-117 | web/components/async_progress_display.py:234-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) REDACTED:266— REDACTED:266-285 | REDACTED:164-183 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (20 lines × 2) scripts/maintenance/finalize_script_organization.py:78— scripts/maintenance/finalize_script_organization.py:78-97 | scripts/maintenance/organize_root_scripts.py:72-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (20 lines × 2) scripts/user_activity_manager.py:67— scripts/user_activity_manager.py:67-86 | scripts/user_activity_manager.py:203-222 — both copies are in the same file, so extract the 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 lines × 2) tradingagents/dataflows/optimized_china_data.py:587— tradingagents/dataflows/optimized_china_data.py:587-598 | tradingagents/dataflows/optimized_china_data.py:604-615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) tradingagents/llm_adapters/dashscope_adapter.py:158— tradingagents/llm_adapters/dashscope_adapter.py:158-169 | tradingagents/llm_adapters/google_openai_adapter.py:150-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 both call sites, so a change lands once.
Duplicated block (12 lines × 2) web/utils/async_progress_tracker.py:473— web/utils/async_progress_tracker.py:473-484 | web/utils/progress_tracker.py:139-150 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) web/utils/file_session_manager.py:194— web/utils/file_session_manager.py:194-205 | REDACTED:137-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, 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) examples/dashscope_examples/demo_dashscope.py:58— examples/dashscope_examples/demo_dashscope.py:58-69 | examples/dashscope_examples/demo_dashscope_no_memory.py:41-52 — before extracting anything, compare `examples/dashscope_examples/demo_dashscope.py` and `examples/dashscope_examples/demo_dashscope_no_memory.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (12 lines × 2) scripts/git/branch_manager.py:62— scripts/git/branch_manager.py:62-73 | scripts/git/branch_manager.py:76-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) scripts/user_activity_manager.py:32— scripts/user_activity_manager.py:32-42 | web/utils/user_activity_logger.py:262-272 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) tradingagents/agents/analysts/fundamentals_analyst.py:123— tradingagents/agents/analysts/fundamentals_analyst.py:123-133 | tradingagents/agents/analysts/market_analyst.py:294-304 — before extracting anything, compare `tradingagents/agents/analysts/fundamentals_analyst.py` and `tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 152 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) REDACTED:221— REDACTED:221-231 | REDACTED:148-158 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) web/components/async_progress_display.py:243— web/components/async_progress_display.py:243-253 | web/components/async_progress_display.py:402-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) web/utils/analysis_runner.py:318— web/utils/analysis_runner.py:318-328 | web/utils/analysis_runner.py:341-351 — both copies are in the same file, so extract the block into 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) scripts/git/branch_manager.py:22— scripts/git/branch_manager.py:22-32 | scripts/git/check_branch_overlap.py:25-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. The matched lines also transfer control out of the body holding them, 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) tradingagents/dataflows/tushare_adapter.py:327— tradingagents/dataflows/tushare_adapter.py:327-332 | tradingagents/dataflows/tushare_utils.py:402-407 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `tradingagents/dataflows/tushare_adapter.py:327` 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 (6 lines × 2) web/components/operation_logs.py:221— web/components/operation_logs.py:221-226 | web/components/user_activity_dashboard.py:91-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.
Duplicated block (6 lines × 2) scripts/development/download_finnhub_sample_data.py:117— scripts/development/download_finnhub_sample_data.py:117-122 | scripts/development/download_finnhub_sample_data.py:178-183 — both copies are in the same file, so extract the block into 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) scripts/maintenance/finalize_script_organization.py:22— scripts/maintenance/finalize_script_organization.py:22-27 | scripts/maintenance/organize_root_scripts.py:21-26 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/maintenance/finalize_script_organization.py:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) examples/dashscope_examples/demo_dashscope.py:73— examples/dashscope_examples/demo_dashscope.py:73-78 | examples/dashscope_examples/demo_dashscope_no_memory.py:56-61 — before extracting anything, compare `examples/dashscope_examples/demo_dashscope.py` and `examples/dashscope_examples/demo_dashscope_no_memory.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `examples/dashscope_examples/demo_dashscope_no_memory.py:62` calls `info` and `examples/dashscope_examples/demo_dashscope.py:79` 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 (19 lines × 2) tradingagents/graph/setup.py:71— tradingagents/graph/setup.py:71-89 | tradingagents/graph/setup.py:112-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) tradingagents/llm_adapters/dashscope_openai_adapter.py:167— tradingagents/llm_adapters/dashscope_openai_adapter.py:167-185 | tradingagents/llm_adapters/google_openai_adapter.py:262-280 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `tradingagents/llm_adapters/dashscope_openai_adapter.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. The matched lines also transfer control out of the body holding them, 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 `model` to `str = "qwen-turbo"` in one and `str = "gemini-2.0-flash"` 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 (19 lines × 2) web/components/async_progress_display.py:393— web/components/async_progress_display.py:393-411 | web/components/async_progress_display.py:563-581 — both copies are in the same file, so extract the 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 after the matched lines, `web/components/async_progress_display.py:583` calls `error` and `web/components/async_progress_display.py:412` 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 (19 lines × 2) scripts/setup/configure_pip_source.py:134— scripts/setup/configure_pip_source.py:134-152 | scripts/setup/manual_pip_config.py:109-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 (17 lines × 2) tradingagents/agents/utils/memory.py:448— tradingagents/agents/utils/memory.py:448-464 | tradingagents/agents/utils/memory.py:477-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. The matched lines also transfer control out of the body holding them, 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) web/components/analysis_results.py:1426— web/components/analysis_results.py:1426-1442 | web/components/results_display.py:427-443 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `web/components/analysis_results.py:1426` 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 (17 lines × 2) web/components/operation_logs.py:162— web/components/operation_logs.py:162-178 | web/components/user_activity_dashboard.py:32-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, 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) scripts/analyze_data_calls.py:32— scripts/analyze_data_calls.py:32-48 | scripts/log_analyzer.py:31-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) tradingagents/agents/utils/agent_utils.py:649— tradingagents/agents/utils/agent_utils.py:649-657 | tradingagents/agents/utils/agent_utils.py:686-694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) web/modules/cache_management.py:134— web/modules/cache_management.py:134-142 | web/modules/cache_management.py:144-152 — both copies are in the same file, so extract the 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 `web/modules/cache_management.py:134` 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 (9 lines × 2) web/modules/database_management.py:190— web/modules/database_management.py:190-198 | web/modules/database_management.py:214-222 — both copies are in the same file, so extract the 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 `web/modules/database_management.py:190` 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 (9 lines × 2) web/run_web.py:135— web/run_web.py:135-143 | web/run_web.py:148-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) web/components/sidebar.py:463— web/components/sidebar.py:463-470 | web/components/sidebar.py:905-912 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) web/utils/file_session_manager.py:112— web/utils/file_session_manager.py:112-119 | REDACTED:62-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) REDACTED:515— REDACTED:515-522 | REDACTED:515-522 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) scripts/quick_syntax_check.py:37— scripts/quick_syntax_check.py:37-44 | scripts/syntax_checker.py:41-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 matched lines also transfer control out of the body holding them, 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· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (5 members, 50+ identical tokens) tradingagents/agents/analysts/china_market_analyst.py:14— tradingagents/agents/analysts/china_market_analyst.py:14-74 | tradingagents/agents/analysts/fundamentals_analyst.py:21-81 | tradingagents/agents/analysts/market_analyst.py:20-80 | tradingagents/agents/analysts/news_analyst.py:21-93 | tradingagents/agents/analysts/social_media_analyst.py:15-75 — 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) tradingagents/agents/analysts/china_market_analyst.py:78— tradingagents/agents/analysts/china_market_analyst.py:78-195 | tradingagents/agents/analysts/china_market_analyst.py:199-277 | tradingagents/agents/analysts/fundamentals_analyst.py:86-354 | tradingagents/agents/analysts/market_analyst.py:268-518 | tradingagents/agents/analysts/social_media_analyst.py:80-213 — 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) tradingagents/dataflows/optimized_china_data.py:127— tradingagents/dataflows/optimized_china_data.py:127-187 | tradingagents/dataflows/optimized_china_data.py:1064-1087 | tradingagents/dataflows/optimized_us_data.py:244-266 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:209-231 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:209-231 — 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· Edited copy of a member (45 corresponding lines) · ×3
Edited copy of a member (45 corresponding lines) tradingagents/utils/enhanced_news_filter.py:257— tradingagents/utils/enhanced_news_filter.py:257-301 | tradingagents/utils/news_filter.py:135-179 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (45 corresponding lines) tradingagents/dataflows/interface.py:395— tradingagents/dataflows/interface.py:395-439 | tradingagents/dataflows/interface.py:448-498 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (45 corresponding lines) tradingagents/llm_adapters/dashscope_openai_adapter.py:192— tradingagents/llm_adapters/dashscope_openai_adapter.py:192-237 | tradingagents/llm_adapters/google_openai_adapter.py:287-331 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (37 lines × 2) REDACTED:126— REDACTED:126-162 | REDACTED:126-162 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (37 lines × 2) REDACTED:362— REDACTED:362-398 | REDACTED:362-398 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (37 lines × 2) scripts/download_finnhub_data.py:193— scripts/download_finnhub_data.py:193-229 | scripts/download_finnhub_data.py:232-268 — both copies are in the same file, so extract the 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 (32 lines × 2) tradingagents/dataflows/interface.py:788— tradingagents/dataflows/interface.py:788-819 | tradingagents/dataflows/interface.py:823-854 — both copies are in the same file, so extract the 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 (32 lines × 2) tradingagents/utils/tool_logging.py:163— tradingagents/utils/tool_logging.py:163-194 | tradingagents/utils/tool_logging.py:226-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tradingagents/utils/tool_logging.py:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (32 lines × 2) web/utils/async_progress_tracker.py:604— web/utils/async_progress_tracker.py:604-635 | web/utils/async_progress_tracker.py:668-699 — both copies are in the same file, so extract the block into 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) REDACTED:25— REDACTED:25-55 | REDACTED:25-55 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:25` 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 (31 lines × 2) REDACTED:234— REDACTED:234-264 | REDACTED:161-191 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (31 lines × 2) REDACTED:46— REDACTED:46-76 | REDACTED:46-76 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) cli/utils.py:201— cli/utils.py:201-230 | cli/utils.py:301-330 — both copies are in the same file, so extract the 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 `cli/utils.py:201` 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 (30 lines × 2) REDACTED:463— REDACTED:463-492 | REDACTED:463-492 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (30 lines × 2) tradingagents/utils/stock_validator.py:354— tradingagents/utils/stock_validator.py:354-383 | tradingagents/utils/stock_validator.py:502-531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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 (25 lines × 2) web/components/analysis_results.py:1527— web/components/analysis_results.py:1527-1551 | web/components/results_display.py:446-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 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 (25 lines × 2) scripts/development/adaptive_cache_manager.py:379— scripts/development/adaptive_cache_manager.py:379-403 | scripts/validation/check_system_status.py:139-163 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/development/adaptive_cache_manager.py:379` 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 (25 lines × 2) scripts/setup/setup_databases.py:103— scripts/setup/setup_databases.py:103-127 | scripts/setup/setup_databases.py:130-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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 (23 lines × 2) REDACTED:79— REDACTED:79-101 | REDACTED:79-101 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (23 lines × 2) tradingagents/dataflows/optimized_china_data.py:689— tradingagents/dataflows/optimized_china_data.py:689-711 | tradingagents/dataflows/optimized_china_data.py:796-819 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tradingagents/dataflows/optimized_china_data.py:689` 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, `tradingagents/dataflows/optimized_china_data.py:713` calls `info` and `tradingagents/dataflows/optimized_china_data.py:821` 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 (23 lines × 2) web/components/async_progress_display.py:119— web/components/async_progress_display.py:119-141 | web/components/async_progress_display.py:255-277 — both copies are in the same file, so extract the 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 `web/components/async_progress_display.py:119` 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 (15 lines × 2) REDACTED:495— REDACTED:495-509 | REDACTED:378-392 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) tradingagents/dataflows/data_source_manager.py:480— tradingagents/dataflows/data_source_manager.py:480-494 | tradingagents/dataflows/data_source_manager.py:530-544 — both copies are in the same file, so extract the block into 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) web/components/login.py:364— web/components/login.py:364-378 | web/components/login.py:509-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `web/components/login.py:364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) web/components/analysis_results.py:364— web/components/analysis_results.py:364-373 | web/components/operation_logs.py:171-180 | web/components/user_activity_dashboard.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 all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `web/components/analysis_results.py:358` calls `text_input`, `checkbox` and `web/components/operation_logs.py:168` 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 (10 lines × 3) web/utils/analysis_runner.py:245— web/utils/analysis_runner.py:245-254 | web/utils/analysis_runner.py:271-280 | web/utils/analysis_runner.py:282-291 — 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 `web/utils/analysis_runner.py:245` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) tradingagents/dataflows/optimized_us_data.py:34— tradingagents/dataflows/optimized_us_data.py:34-43 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:34-43 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:34-43 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
analysis_results.render_results_comparison (cyclomatic 32) web/components/analysis_results.py:600— analysis_results.render_results_comparison 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. This shape REPEATS in the file: one other method here (analysis_results.render_results_comparison) 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.
analysis_results.render_results_comparison (cyclomatic 32) web/components/analysis_results.py:974— analysis_results.render_results_comparison 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. This shape REPEATS in the file: one other method here (analysis_results.render_results_comparison) 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.
analysis_results.render_results_comparison (cognitive 64) web/components/analysis_results.py:600— analysis_results.render_results_comparison has cognitive complexity 64 (threshold 15). Drivers by points: if/else 26 (43 pts), loops 6 (13 pts), boolean chains 6, ternaries 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. This shape REPEATS in the file: one other method here (analysis_results.render_results_comparison) 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.
analysis_results.render_results_comparison (cognitive 64) web/components/analysis_results.py:974— analysis_results.render_results_comparison has cognitive complexity 64 (threshold 15). Drivers by points: if/else 26 (43 pts), loops 6 (13 pts), boolean chains 6, ternaries 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. This shape REPEATS in the file: one other method here (analysis_results.render_results_comparison) 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.
DatabaseCacheManager.load_stock_data (cognitive 25) REDACTED:256— DatabaseCacheManager.load_stock_data has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 3 (8 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.
DatabaseCacheManager.load_stock_data (cognitive 25) REDACTED:256— DatabaseCacheManager.load_stock_data has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 3 (8 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.
OptimizedUSDataProvider.get_stock_data (cognitive 19) upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:45— OptimizedUSDataProvider.get_stock_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 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.
OptimizedUSDataProvider.get_stock_data (cognitive 19) upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:45— OptimizedUSDataProvider.get_stock_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 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.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:176— REDACTED:176-254 | REDACTED:362-408 | REDACTED:413-460 | REDACTED:176-254 | REDACTED:362-408 | REDACTED:413-460 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/install_pandoc.py:63— scripts/install_pandoc.py:63-99 | scripts/install_pandoc.py:102-122 | scripts/install_pandoc.py:125-163 | scripts/install_pdf_tools.py:49-84 | scripts/install_pdf_tools.py:87-104 | scripts/install_pdf_tools.py:107-143 — 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 (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) tradingagents/llm_adapters/dashscope_openai_adapter.py:54— tradingagents/llm_adapters/dashscope_openai_adapter.py:54-87 | tradingagents/llm_adapters/google_openai_adapter.py:138-167 — 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.
Edited copy of a member (30 corresponding lines) tradingagents/dataflows/optimized_china_data.py:828— tradingagents/dataflows/optimized_china_data.py:828-857 | tradingagents/dataflows/optimized_china_data.py:860-891 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) scripts/development/adaptive_cache_manager.py:283— scripts/development/adaptive_cache_manager.py:283-311 | REDACTED:272-301 — 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) tradingagents/dataflows/integrated_cache.py:73— tradingagents/dataflows/integrated_cache.py:73-104 | tradingagents/dataflows/integrated_cache.py:125-153 — 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 (24 corresponding lines) · ×2
Edited copy of a member (24 corresponding lines) REDACTED:196— REDACTED:196-242 | REDACTED:352-375 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) scripts/analyze_data_calls.py:354— scripts/analyze_data_calls.py:354-377 | scripts/log_analyzer.py:345-368 — 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 (8 corresponding lines) · ×2
Edited copy of a member (8 corresponding lines) web/utils/auth_manager.py:387— web/utils/auth_manager.py:387-395 | web/utils/auth_manager.py:398-405 — 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) scripts/analyze_data_calls.py:309— scripts/analyze_data_calls.py:309-319 | scripts/log_analyzer.py:299-310 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×2
Edited copies of one member (3 members, 17+ corresponding lines) web/utils/file_session_manager.py:156— web/utils/file_session_manager.py:156-172 | REDACTED:150-168 | REDACTED:105-121 — 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.
Edited copies of one member (3 members, 17+ corresponding lines) scripts/convert_prints_to_logs.py:229— scripts/convert_prints_to_logs.py:229-245 | scripts/fix_logging_imports.py:157-173 | scripts/migrate_to_unified_logging.py:209-227 — 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 copy of a member (13 corresponding lines) · ×2
Edited copy of a member (13 corresponding lines) scripts/development/adaptive_cache_manager.py:189— scripts/development/adaptive_cache_manager.py:189-201 | REDACTED:91-105 — 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) scripts/install_pandoc.py:18— scripts/install_pandoc.py:18-30 | scripts/install_pdf_tools.py:18-30 — 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· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) REDACTED:212— REDACTED:212-218 | REDACTED:140-145 — 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) scripts/deployment/release_v0.1.9.py:18— scripts/deployment/release_v0.1.9.py:18-30 | scripts/verify_docker_logs.py:12-17 — 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.
Duplicated block (29 lines × 2) web/utils/async_progress_tracker.py:294— web/utils/async_progress_tracker.py:294-322 | web/utils/progress_tracker.py:67-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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 (29 lines × 2) scripts/install_pandoc.py:135— scripts/install_pandoc.py:135-163 | scripts/install_pdf_tools.py:115-143 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/install_pandoc.py:135` 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 (23–24 lines × 2) tradingagents/agents/utils/agent_utils.py:890— tradingagents/agents/utils/agent_utils.py:890-913 | tradingagents/agents/utils/agent_utils.py:1110-1132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–24 lines × 2) tradingagents/dataflows/interface.py:124— tradingagents/dataflows/interface.py:124-146 | tradingagents/dataflows/interface.py:165-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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 (24 lines × 2) REDACTED:555— REDACTED:555-578 | REDACTED:438-461 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) web/components/operation_logs.py:304— web/components/operation_logs.py:304-327 | web/components/user_activity_dashboard.py:145-168 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `web/components/operation_logs.py:304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–22 lines × 2) REDACTED:581— REDACTED:581-602 | REDACTED:464-484 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 2) web/components/analysis_form.py:36— web/components/analysis_form.py:36-56 | web/components/batch_analysis_form.py:32-53 — before extracting anything, compare `web/components/analysis_form.py` and `web/components/batch_analysis_form.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 148 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 (19–20 lines × 2) tradingagents/dataflows/interface.py:419— tradingagents/dataflows/interface.py:419-437 | tradingagents/dataflows/interface.py:477-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tradingagents/dataflows/interface.py:419` 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 (19–20 lines × 2) examples/dashscope_examples/demo_dashscope_chinese.py:27— examples/dashscope_examples/demo_dashscope_chinese.py:27-46 | examples/dashscope_examples/demo_dashscope_no_memory.py:27-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (18 lines × 3) tradingagents/agents/risk_mgmt/aggresive_debator.py:10— tradingagents/agents/risk_mgmt/aggresive_debator.py:10-27 | tradingagents/agents/risk_mgmt/conservative_debator.py:11-28 | tradingagents/agents/risk_mgmt/neutral_debator.py:10-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (18 lines × 3) scripts/user_activity_manager.py:62— scripts/user_activity_manager.py:62-79 | scripts/user_activity_manager.py:117-134 | scripts/user_activity_manager.py:198-215 — 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 `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–16 lines × 2) tradingagents/dataflows/improved_hk_utils.py:187— tradingagents/dataflows/improved_hk_utils.py:187-201 | tradingagents/dataflows/improved_hk_utils.py:207-222 — both copies are in the same file, so extract the 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–16 lines × 2) web/components/analysis_results.py:940— web/components/analysis_results.py:940-954 | web/components/operation_logs.py:506-521 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) tradingagents/llm_adapters/dashscope_openai_adapter.py:60— tradingagents/llm_adapters/dashscope_openai_adapter.py:60-75 | tradingagents/llm_adapters/google_openai_adapter.py:140-155 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `tradingagents/llm_adapters/dashscope_openai_adapter.py:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) web/components/analysis_form.py:348— web/components/analysis_form.py:348-363 | web/components/batch_analysis_form.py:320-335 — before extracting anything, compare `web/components/analysis_form.py` and `web/components/batch_analysis_form.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 148 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 (13 lines × 3) web/components/analysis_results.py:728— web/components/analysis_results.py:728-740 | web/components/operation_logs.py:298-310 | web/components/user_activity_dashboard.py:139-151 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `web/components/analysis_results.py:728` 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 (13 lines × 3) scripts/deployment/create_github_release.py:18— scripts/deployment/create_github_release.py:18-30 | scripts/deployment/release_v0.1.2.py:18-30 | scripts/deployment/release_v0.1.3.py:18-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
Duplicated block (9 lines × 3) tradingagents/agents/analysts/fundamentals_analyst.py:123— tradingagents/agents/analysts/fundamentals_analyst.py:123-131 | tradingagents/agents/analysts/fundamentals_analyst.py:234-242 | tradingagents/agents/analysts/market_analyst.py:294-302 — before extracting anything, compare `tradingagents/agents/analysts/fundamentals_analyst.py` and `tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) web/utils/async_progress_tracker.py:656— web/utils/async_progress_tracker.py:656-664 | web/utils/progress_tracker.py:263-271 | web/utils/progress_tracker.py:313-321 — 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 (8 lines × 4) tradingagents/dataflows/interface.py:732— tradingagents/dataflows/interface.py:732-739 | tradingagents/dataflows/optimized_us_data.py:187-194 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:152-159 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:152-159 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) web/utils/file_session_manager.py:219— web/utils/file_session_manager.py:219-226 | REDACTED:264-271 | REDACTED:162-169 | web/utils/smart_session_manager.py:145-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 all 4 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `web/utils/file_session_manager.py:227` calls `get` and `web/utils/smart_session_manager.py:153` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) tradingagents/agents/analysts/market_analyst.py:271— tradingagents/agents/analysts/market_analyst.py:271-275 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:246-250 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:202-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) web/components/operation_logs.py:219— web/components/operation_logs.py:219-223 | web/components/user_activity_dashboard.py:89-93 | web/components/user_activity_dashboard.py:384-388 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 2) web/components/sidebar.py:974— web/components/sidebar.py:974-978 | web/components/sidebar.py:984-988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) scripts/user_activity_manager.py:309— scripts/user_activity_manager.py:309-313 | scripts/user_activity_manager.py:322-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark reports/batch_analysis_report_batch_3e08ecf5_20250924_172010_20250924_173249.html:3— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
app.main (cyclomatic 85) web/app.py:594— app.main has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sidebar.render_sidebar (cyclomatic 85) web/components/sidebar.py:32— sidebar.render_sidebar has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.run_analysis (cyclomatic 77) cli/main.py:1028— main.run_analysis has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
app.render_batch_analysis_page (cyclomatic 73) web/app.py:1622— app.render_batch_analysis_page has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
analysis_runner.run_stock_analysis (cyclomatic 72) web/utils/analysis_runner.py:100— analysis_runner.run_stock_analysis has cyclomatic complexity 72 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SmartAnalysisProgressTracker._detect_step_from_message (cyclomatic 60) web/utils/progress_tracker.py:165— SmartAnalysisProgressTracker._detect_step_from_message has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GoogleToolCallHandler.handle_google_tool_calls (cyclomatic 59) tradingagents/agents/utils/google_tool_handler.py:26— GoogleToolCallHandler.handle_google_tool_calls has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
analysis_runner.generate_demo_results_deprecated (cyclomatic 57) web/utils/analysis_runner.py:824— analysis_runner.generate_demo_results_deprecated 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.
analysis_results.render_detailed_analysis_content (cyclomatic 47) web/components/analysis_results.py:1240— analysis_results.render_detailed_analysis_content 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.
analysis_form.render_analysis_form (cyclomatic 45) web/components/analysis_form.py:20— analysis_form.render_analysis_form 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.
analysis_results.load_analysis_results (cyclomatic 44) web/components/analysis_results.py:125— analysis_results.load_analysis_results 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.
AsyncProgressTracker._detect_step_from_message (cyclomatic 38) web/utils/async_progress_tracker.py:389— AsyncProgressTracker._detect_step_from_message has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FinancialSituationMemory.get_embedding (cyclomatic 37) tradingagents/agents/utils/memory.py:362— FinancialSituationMemory.get_embedding 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.
OptimizedChinaDataProvider._parse_akshare_financial_data (cyclomatic 36) tradingagents/dataflows/optimized_china_data.py:544— OptimizedChinaDataProvider._parse_akshare_financial_data has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
realtime_news_utils.get_realtime_stock_news (cyclomatic 33) tradingagents/dataflows/realtime_news_utils.py:677— realtime_news_utils.get_realtime_stock_news 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.
FinancialSituationMemory.__init__ (cyclomatic 31) tradingagents/agents/utils/memory.py:111— FinancialSituationMemory.__init__ 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.
batch_analysis_form.render_batch_analysis_form (cyclomatic 31) web/components/batch_analysis_form.py:23— batch_analysis_form.render_batch_analysis_form 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.
OptimizedChinaDataProvider._generate_fundamentals_report (cyclomatic 29) tradingagents/dataflows/optimized_china_data.py:189— OptimizedChinaDataProvider._generate_fundamentals_report 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.
operation_logs.load_operation_logs (cyclomatic 29) web/components/operation_logs.py:27— operation_logs.load_operation_logs has cyclomatic complexity 29 (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.
StockDataPreparer._extract_hk_stock_name (cyclomatic 28) tradingagents/utils/stock_validator.py:194— StockDataPreparer._extract_hk_stock_name 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.
async_progress_display.display_static_progress_with_controls (cyclomatic 28) web/components/async_progress_display.py:463— async_progress_display.display_static_progress_with_controls 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.
report_exporter.render_export_buttons (cyclomatic 28) web/utils/report_exporter.py:900— report_exporter.render_export_buttons 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.
SignalProcessor.process_signal (cyclomatic 27) tradingagents/graph/signal_processing.py:19— SignalProcessor.process_signal 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.
async_progress_display.display_static_progress (cyclomatic 27) web/components/async_progress_display.py:306— async_progress_display.display_static_progress 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.
batch_progress_display.render_batch_progress_display (cyclomatic 27) web/components/batch_progress_display.py:16— batch_progress_display.render_batch_progress_display 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.
interface.get_fundamentals_finnhub (cyclomatic 26) tradingagents/dataflows/interface.py:857— interface.get_fundamentals_finnhub has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
app.initialize_session_state (cyclomatic 26) web/app.py:319— app.initialize_session_state 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.
cache_management.main (cyclomatic 25) web/modules/cache_management.py:31— cache_management.main 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.
run_web.clean_cache_files (cyclomatic 25) web/run_web.py:43— run_web.clean_cache_files 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.
OptimizedChinaDataProvider._parse_financial_data (cyclomatic 23) tradingagents/dataflows/optimized_china_data.py:720— OptimizedChinaDataProvider._parse_financial_data 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.
main.update_display (cyclomatic 22) cli/main.py:307— main.update_display 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.
TradingAgentsGraph.__init__ (cyclomatic 21) tradingagents/graph/trading_graph.py:43— TradingAgentsGraph.__init__ 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.
operation_logs.render_logs_export (cyclomatic 21) web/components/operation_logs.py:404— operation_logs.render_logs_export 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.
analysis_results.show_expanded_detail (cyclomatic 20) web/components/analysis_results.py:1694— analysis_results.show_expanded_detail 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.
batch_analysis_runner.run_batch_stock_analysis (cyclomatic 20) web/utils/batch_analysis_runner.py:59— batch_analysis_runner.run_batch_stock_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.
report_exporter.save_modular_reports_to_results_dir (cyclomatic 20) web/utils/report_exporter.py:641— report_exporter.save_modular_reports_to_results_dir has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Toolkit.get_stock_fundamentals_unified (cyclomatic 19) tradingagents/agents/utils/agent_utils.py:699— Toolkit.get_stock_fundamentals_unified 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.
TushareProvider.get_stock_daily (cyclomatic 19) tradingagents/dataflows/tushare_utils.py:154— TushareProvider.get_stock_daily 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.
GraphSetup.setup_graph (cyclomatic 19) tradingagents/graph/setup.py:51— GraphSetup.setup_graph 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.
NewsRelevanceFilter.calculate_relevance_score (cyclomatic 19) tradingagents/utils/news_filter.py:51— NewsRelevanceFilter.calculate_relevance_score 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.
async_progress_display.streamlit_auto_refresh_progress (cyclomatic 19) web/components/async_progress_display.py:193— async_progress_display.streamlit_auto_refresh_progress 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.
results_display.render_detailed_analysis (cyclomatic 19) web/components/results_display.py:278— results_display.render_detailed_analysis 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.
main.display_complete_report (cyclomatic 18) cli/main.py:757— main.display_complete_report 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.
GoogleToolCallHandler._fix_tool_call (cyclomatic 18) tradingagents/agents/utils/google_tool_handler.py:437— GoogleToolCallHandler._fix_tool_call 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.
AKShareProvider.get_financial_data (cyclomatic 18) REDACTED:328— AKShareProvider.get_financial_data 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.
UnifiedNewsAnalyzer._format_news_result (cyclomatic 18) tradingagents/tools/unified_news_tool.py:238— UnifiedNewsAnalyzer._format_news_result 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.
analysis_results.render_results_cards (cyclomatic 18) web/components/analysis_results.py:497— analysis_results.render_results_cards 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.
analysis_results.render_tags_management (cyclomatic 18) web/components/analysis_results.py:813— analysis_results.render_tags_management 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.
analysis_runner.validate_analysis_params (cyclomatic 18) web/utils/analysis_runner.py:746— analysis_runner.validate_analysis_params 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.
OptimizedUSDataProvider.get_stock_data (cyclomatic 17) tradingagents/dataflows/optimized_us_data.py:45— OptimizedUSDataProvider.get_stock_data 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.
GoogleToolCallHandler.generate_final_analysis_report (cyclomatic 16) tradingagents/agents/utils/google_tool_handler.py:529— GoogleToolCallHandler.generate_final_analysis_report 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.
TushareDataAdapter._get_daily_data (cyclomatic 16) tradingagents/dataflows/tushare_adapter.py:110— TushareDataAdapter._get_daily_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.
SignalProcessor._smart_price_estimation (cyclomatic 16) tradingagents/graph/signal_processing.py:216— SignalProcessor._smart_price_estimation 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.
operation_logs.render_operation_logs (cyclomatic 16) web/components/operation_logs.py:146— operation_logs.render_operation_logs 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.
analysis_runner.format_analysis_results (cyclomatic 16) web/utils/analysis_runner.py:614— analysis_runner.format_analysis_results has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReportExporter._add_team_decision_reports (cyclomatic 16) web/utils/report_exporter.py:267— ReportExporter._add_team_decision_reports 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.
XxxComment tradingagents/utils/stock_validator.py:217— # 方法1: 标准格式 "公司名称: XXX" — 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.
app.render_batch_analysis_page (cognitive 188) web/app.py:1622— app.render_batch_analysis_page has cognitive complexity 188 (threshold 15). Drivers by points: if/else 59 (130 pts), error handling 14 (38 pts), loops 5 (13 pts), boolean chains 7 (nesting depth added 103). 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.
main.run_analysis (cognitive 185) cli/main.py:1028— main.run_analysis has cognitive complexity 185 (threshold 15). Drivers by points: if/else 46 (142 pts), boolean chains 18, ternaries 3 (11 pts), loops 7 (10 pts), error handling 4 (nesting depth added 107). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
app.main (cognitive 151) web/app.py:594— app.main has cognitive complexity 151 (threshold 15). Drivers by points: if/else 52 (96 pts), error handling 13 (31 pts), loops 5 (12 pts), boolean chains 11, ternaries 1 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sidebar.render_sidebar (cognitive 144) web/components/sidebar.py:32— sidebar.render_sidebar has cognitive complexity 144 (threshold 15). Drivers by points: if/else 70 (134 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 67). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_results.render_detailed_analysis_content (cognitive 131) web/components/analysis_results.py:1240— analysis_results.render_detailed_analysis_content has cognitive complexity 131 (threshold 15). Drivers by points: if/else 34 (93 pts), loops 11 (33 pts), boolean chains 5 (nesting depth added 81). 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.
analysis_results.load_analysis_results (cognitive 126) web/components/analysis_results.py:125— analysis_results.load_analysis_results has cognitive complexity 126 (threshold 15). Drivers by points: if/else 23 (78 pts), error handling 5 (24 pts), loops 6 (17 pts), boolean chains 6, ternaries 1 (nesting depth added 85). 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.
GoogleToolCallHandler.handle_google_tool_calls (cognitive 119) tradingagents/agents/utils/google_tool_handler.py:26— GoogleToolCallHandler.handle_google_tool_calls has cognitive complexity 119 (threshold 15). Drivers by points: if/else 38 (70 pts), ternaries 10 (22 pts), loops 8 (14 pts), error handling 4 (9 pts), boolean chains 4 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_runner.run_stock_analysis (cognitive 86) web/utils/analysis_runner.py:100— analysis_runner.run_stock_analysis has cognitive complexity 86 (threshold 15). Drivers by points: if/else 45 (66 pts), ternaries 7 (11 pts), error handling 4 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmartAnalysisProgressTracker._detect_step_from_message (cognitive 78) web/utils/progress_tracker.py:165— SmartAnalysisProgressTracker._detect_step_from_message has cognitive complexity 78 (threshold 15). Drivers by points: if/else 11 (36 pts), boolean chains 22, loops 7 (20 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.
FinancialSituationMemory.__init__ (cognitive 77) tradingagents/agents/utils/memory.py:111— FinancialSituationMemory.__init__ has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (38 pts), error handling 11 (37 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_runner.generate_demo_results_deprecated (cognitive 75) web/utils/analysis_runner.py:824— analysis_runner.generate_demo_results_deprecated has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 50 (69 pts), if/else 6 (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.
analysis_form.render_analysis_form (cognitive 61) web/components/analysis_form.py:20— analysis_form.render_analysis_form has cognitive complexity 61 (threshold 15). Drivers by points: if/else 23 (30 pts), ternaries 9 (12 pts), boolean chains 11, error handling 4 (8 pts) (nesting depth added 14). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
analysis_results.show_expanded_detail (cognitive 61) web/components/analysis_results.py:1694— analysis_results.show_expanded_detail has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 5 (19 pts), boolean chains 3 (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.
FinancialSituationMemory.get_embedding (cognitive 60) tradingagents/agents/utils/memory.py:362— FinancialSituationMemory.get_embedding has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (36 pts), error handling 4 (14 pts), boolean chains 10 (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.
operation_logs.render_logs_export (cognitive 60) web/components/operation_logs.py:404— operation_logs.render_logs_export has cognitive complexity 60 (threshold 15). Drivers by points: error handling 7 (32 pts), if/else 5 (12 pts), ternaries 2 (8 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
realtime_news_utils.get_realtime_stock_news (cognitive 59) tradingagents/dataflows/realtime_news_utils.py:677— realtime_news_utils.get_realtime_stock_news has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (38 pts), error handling 5 (8 pts), loops 2 (6 pts), ternaries 1 (4 pts), boolean chains 3 (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.
operation_logs.load_operation_logs (cognitive 59) web/components/operation_logs.py:27— operation_logs.load_operation_logs has cognitive complexity 59 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 6 (19 pts), loops 6 (10 pts), boolean chains 5 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OptimizedChinaDataProvider._parse_akshare_financial_data (cognitive 57) tradingagents/dataflows/optimized_china_data.py:544— OptimizedChinaDataProvider._parse_akshare_financial_data has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (26 pts), error handling 10 (19 pts), boolean chains 10, loops 1, ternaries 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.
cache_management.main (cognitive 56) web/modules/cache_management.py:31— cache_management.main has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (29 pts), error handling 5 (13 pts), ternaries 2 (8 pts), loops 3 (6 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.
batch_progress_display.render_batch_progress_display (cognitive 54) web/components/batch_progress_display.py:16— batch_progress_display.render_batch_progress_display has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (42 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
report_exporter.render_export_buttons (cognitive 54) web/utils/report_exporter.py:900— report_exporter.render_export_buttons has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (34 pts), loops 3 (12 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SignalProcessor.process_signal (cognitive 53) tradingagents/graph/signal_processing.py:19— SignalProcessor.process_signal has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (29 pts), error handling 3 (9 pts), boolean chains 7, ternaries 2 (5 pts), loops 1 (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.
OptimizedChinaDataProvider._generate_fundamentals_report (cognitive 52) tradingagents/dataflows/optimized_china_data.py:189— OptimizedChinaDataProvider._generate_fundamentals_report has cognitive complexity 52 (threshold 15). Drivers by points: if/else 11 (26 pts), error handling 3 (10 pts), loops 4 (10 pts), boolean chains 4, ternaries 2 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StockDataPreparer._extract_hk_stock_name (cognitive 51) tradingagents/utils/stock_validator.py:194— StockDataPreparer._extract_hk_stock_name has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
run_web.clean_cache_files (cognitive 50) web/run_web.py:43— run_web.clean_cache_files has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (26 pts), error handling 6 (13 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
report_exporter.save_modular_reports_to_results_dir (cognitive 49) web/utils/report_exporter.py:641— report_exporter.save_modular_reports_to_results_dir has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 3 (8 pts), error handling 3 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_results.render_tags_management (cognitive 46) web/components/analysis_results.py:813— analysis_results.render_tags_management has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 6 (17 pts), boolean chains 2 (nesting depth added 29). 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.
async_progress_display.display_static_progress (cognitive 46) web/components/async_progress_display.py:306— async_progress_display.display_static_progress has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 4, error handling 1 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
async_progress_display.display_static_progress_with_controls (cognitive 45) web/components/async_progress_display.py:463— async_progress_display.display_static_progress_with_controls has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 7, error handling 1 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
app.initialize_session_state (cognitive 43) web/app.py:319— app.initialize_session_state has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (37 pts), error handling 3 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GoogleToolCallHandler.generate_final_analysis_report (cognitive 41) tradingagents/agents/utils/google_tool_handler.py:529— GoogleToolCallHandler.generate_final_analysis_report has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (28 pts), ternaries 2 (7 pts), loops 2 (3 pts), error handling 1 (2 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.
batch_analysis_runner.run_batch_stock_analysis (cognitive 41) web/utils/batch_analysis_runner.py:59— batch_analysis_runner.run_batch_stock_analysis has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 8 (18 pts), loops 1, ternaries 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.
RealtimeNewsAggregator._get_chinese_finance_news (cognitive 40) tradingagents/dataflows/realtime_news_utils.py:299— RealtimeNewsAggregator._get_chinese_finance_news has cognitive complexity 40 (threshold 15). Drivers by points: error handling 6 (19 pts), if/else 8 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_analysis_form.render_batch_analysis_form (cognitive 40) web/components/batch_analysis_form.py:23— batch_analysis_form.render_batch_analysis_form has cognitive complexity 40 (threshold 15). Drivers by points: if/else 20 (26 pts), ternaries 6, boolean chains 4, error handling 2 (4 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
results_display.render_detailed_analysis (cognitive 40) web/components/results_display.py:278— results_display.render_detailed_analysis has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 4 (8 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.update_display (cognitive 39) cli/main.py:307— main.update_display has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 6 (9 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.
GoogleToolCallHandler._fix_tool_call (cognitive 36) tradingagents/agents/utils/google_tool_handler.py:437— GoogleToolCallHandler._fix_tool_call has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), error handling 3 (8 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OptimizedUSDataProvider.get_stock_data (cognitive 36) tradingagents/dataflows/optimized_us_data.py:45— OptimizedUSDataProvider.get_stock_data has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (28 pts), error handling 3 (6 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.
BatchReportExporter._generate_markdown_content (cognitive 36) web/utils/batch_report_exporter.py:339— BatchReportExporter._generate_markdown_content has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 2 (10 pts), loops 3 (7 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
interface.get_fundamentals_finnhub (cognitive 35) tradingagents/dataflows/interface.py:857— interface.get_fundamentals_finnhub has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (25 pts), error handling 5, boolean chains 3, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reddit_utils.fetch_top_from_category (cognitive 35) tradingagents/dataflows/reddit_utils.py:52— reddit_utils.fetch_top_from_category has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_results.render_results_cards (cognitive 35) web/components/analysis_results.py:497— analysis_results.render_results_cards has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 4 (9 pts), loops 2 (4 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.
config_management.render_model_config (cognitive 34) web/modules/config_management.py:55— config_management.render_model_config has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 3 (10 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 18). 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.
TushareProvider.get_stock_daily (cognitive 32) tradingagents/dataflows/tushare_utils.py:154— TushareProvider.get_stock_daily has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 3 (5 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
async_progress_display.streamlit_auto_refresh_progress (cognitive 32) web/components/async_progress_display.py:193— async_progress_display.streamlit_auto_refresh_progress has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Toolkit.get_stock_fundamentals_unified (cognitive 30) tradingagents/agents/utils/agent_utils.py:699— Toolkit.get_stock_fundamentals_unified has cognitive complexity 30 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 9 (11 pts), ternaries 3 (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.
TongDaXinDataProvider._get_stock_name (cognitive 30) tradingagents/dataflows/tdx_utils.py:159— TongDaXinDataProvider._get_stock_name has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (6 pts), error handling 2 (3 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.
operation_logs.render_logs_list (cognitive 30) web/components/operation_logs.py:342— operation_logs.render_logs_list has cognitive complexity 30 (threshold 15). Drivers by points: error handling 3 (12 pts), if/else 6 (9 pts), ternaries 2 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
async_progress_tracker.get_latest_analysis_id (cognitive 30) web/utils/async_progress_tracker.py:667— async_progress_tracker.get_latest_analysis_id has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OptimizedChinaDataProvider._parse_financial_data (cognitive 29) tradingagents/dataflows/optimized_china_data.py:720— OptimizedChinaDataProvider._parse_financial_data has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, boolean chains 10, ternaries 3, 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.
TushareDataAdapter._get_daily_data (cognitive 29) tradingagents/dataflows/tushare_adapter.py:110— TushareDataAdapter._get_daily_data has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 4, error handling 1 (2 pts), 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.
AsyncProgressDisplay._render_progress (cognitive 29) web/components/async_progress_display.py:63— AsyncProgressDisplay._render_progress has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), error handling 2 (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.
DataSourceManager._get_akshare_data (cognitive 28) tradingagents/dataflows/data_source_manager.py:467— DataSourceManager._get_akshare_data has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 4 (7 pts), error handling 2 (5 pts), boolean chains 2 (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.
UnifiedNewsAnalyzer._format_news_result (cognitive 28) tradingagents/tools/unified_news_tool.py:238— UnifiedNewsAnalyzer._format_news_result has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, loops 1 (2 pts), 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.
analysis_runner.format_analysis_results (cognitive 28) web/utils/analysis_runner.py:614— analysis_runner.format_analysis_results has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.display_complete_report (cognitive 26) cli/main.py:757— main.display_complete_report has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (26 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.
SignalProcessor._smart_price_estimation (cognitive 26) tradingagents/graph/signal_processing.py:216— SignalProcessor._smart_price_estimation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (6 pts), ternaries 2 (6 pts), loops 2, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AKShareProvider.get_financial_data (cognitive 25) REDACTED:328— AKShareProvider.get_financial_data has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), error handling 5, boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
googlenews_utils.getNewsData (cognitive 24) tradingagents/dataflows/googlenews_utils.py:39— googlenews_utils.getNewsData has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 4 (9 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatDeepSeek._generate (cognitive 24) tradingagents/llm_adapters/deepseek_adapter.py:77— ChatDeepSeek._generate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, 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.
StockDataPreparer._prepare_china_stock_data (cognitive 24) tradingagents/utils/stock_validator.py:292— StockDataPreparer._prepare_china_stock_data has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, loops 1 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
operation_logs.render_operation_logs (cognitive 24) web/components/operation_logs.py:146— operation_logs.render_operation_logs has cognitive complexity 24 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 8 (10 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TushareProvider.get_stock_list (cognitive 23) tradingagents/dataflows/tushare_utils.py:91— TushareProvider.get_stock_list has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StockDataPreparer._prepare_hk_stock_data (cognitive 23) tradingagents/utils/stock_validator.py:421— StockDataPreparer._prepare_hk_stock_data has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, error handling 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.
analysis_results.render_detailed_analysis (cognitive 23) web/components/analysis_results.py:1173— analysis_results.render_detailed_analysis has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (7 pts), ternaries 2 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.data_config (cognitive 22) cli/main.py:1777— main.data_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts), ternaries 1 (3 pts), error handling 1 (2 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.
RealtimeNewsAggregator._parse_rss_feed (cognitive 22) tradingagents/dataflows/realtime_news_utils.py:428— RealtimeNewsAggregator._parse_rss_feed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), error handling 3 (4 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.
database_management.main (cognitive 22) web/modules/database_management.py:29— database_management.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 3 (6 pts), loops 1 (3 pts), ternaries 2 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
analysis_runner.validate_analysis_params (cognitive 22) web/utils/analysis_runner.py:746— analysis_runner.validate_analysis_params has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, 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.
async_progress_tracker.safe_serialize (cognitive 22) web/utils/async_progress_tracker.py:19— async_progress_tracker.safe_serialize has cognitive complexity 22 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 6 (9 pts), loops 1 (2 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.
ReportExporter._add_team_decision_reports (cognitive 22) web/utils/report_exporter.py:267— ReportExporter._add_team_decision_reports has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 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.
Toolkit.get_stock_news_unified (cognitive 21) tradingagents/agents/utils/agent_utils.py:975— Toolkit.get_stock_news_unified has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 4 (7 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tdx_utils.get_china_stock_data (cognitive 21) tradingagents/dataflows/tdx_utils.py:626— tdx_utils.get_china_stock_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_results.render_results_charts (cognitive 21) web/components/analysis_results.py:695— analysis_results.render_results_charts has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 8 (10 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
OptimizedChinaDataProvider.get_fundamentals_data (cognitive 20) tradingagents/dataflows/optimized_china_data.py:126— OptimizedChinaDataProvider.get_fundamentals_data has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). 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.
GraphSetup.setup_graph (cognitive 20) tradingagents/graph/setup.py:51— GraphSetup.setup_graph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
UnifiedNewsAnalyzer._get_a_share_news (cognitive 20) tradingagents/tools/unified_news_tool.py:93— UnifiedNewsAnalyzer._get_a_share_news has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), boolean chains 3, error handling 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.
config_management.render_usage_statistics (cognitive 20) web/modules/config_management.py:273— config_management.render_usage_statistics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReportExporter.generate_pdf_report (cognitive 20) web/utils/report_exporter.py:445— ReportExporter.generate_pdf_report has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserActivityLogger._read_activities_from_file (cognitive 20) web/utils/user_activity_logger.py:292— UserActivityLogger._read_activities_from_file has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, error handling 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.
FinancialSituationMemory._smart_text_truncation (cognitive 19) tradingagents/agents/utils/memory.py:324— FinancialSituationMemory._smart_text_truncation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 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.
tushare_config.diagnose_tushare_issues (cognitive 19) tradingagents/config/tushare_config.py:178— tushare_config.diagnose_tushare_issues has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 6, ternaries 4 (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.
ChatDashScope._generate (cognitive 19) tradingagents/llm_adapters/dashscope_adapter.py:96— ChatDashScope._generate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 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.
app.check_frontend_auth_cache (cognitive 19) web/app.py:417— app.check_frontend_auth_cache has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 2 (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.
analysis_results.save_analysis_result (cognitive 19) web/components/analysis_results.py:1593— analysis_results.save_analysis_result has cognitive complexity 19 (threshold 15). Drivers by points: error handling 4 (9 pts), if/else 5 (7 pts), loops 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.
operation_logs.render_logs_charts (cognitive 19) web/components/operation_logs.py:259— operation_logs.render_logs_charts has cognitive complexity 19 (threshold 15). Drivers by points: error handling 3 (9 pts), if/else 5 (7 pts), loops 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.
main.main (cognitive 18) cli/main.py:2019— main.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 1 (5 pts), error handling 1 (2 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.
GoogleToolCallHandler._optimize_message_sequence (cognitive 18) tradingagents/agents/utils/google_tool_handler.py:661— GoogleToolCallHandler._optimize_message_sequence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HKStockProvider.get_stock_data (cognitive 18) tradingagents/dataflows/hk_stock_utils.py:43— HKStockProvider.get_stock_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 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.
interface.get_hk_stock_data_unified (cognitive 18) tradingagents/dataflows/interface.py:1394— interface.get_hk_stock_data_unified has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 4 (6 pts), boolean chains 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.
StockDataService.get_stock_basic_info (cognitive 18) tradingagents/dataflows/stock_data_service.py:77— StockDataService.get_stock_basic_info has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), error handling 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.
TradingAgentsGraph.__init__ (cognitive 18) tradingagents/graph/trading_graph.py:43— TradingAgentsGraph.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch_results_display.render_single_stock_result (cognitive 18) web/components/batch_results_display.py:309— batch_results_display.render_single_stock_result has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 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.
user_activity_dashboard.render_user_analysis (cognitive 18) web/components/user_activity_dashboard.py:227— user_activity_dashboard.render_user_analysis has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (5 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AsyncProgressTracker._detect_step_from_message (cognitive 18) web/utils/async_progress_tracker.py:389— AsyncProgressTracker._detect_step_from_message has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 2 (3 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.
FinancialSituationMemory.get_memories (cognitive 17) tradingagents/agents/utils/memory.py:593— FinancialSituationMemory.get_memories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TushareDataAdapter._generate_fundamentals_report (cognitive 17) tradingagents/dataflows/tushare_adapter.py:405— TushareDataAdapter._generate_fundamentals_report has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 5 (8 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check_version_consistency.main (cognitive 17) utils/check_version_consistency.py:70— check_version_consistency.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis_results.render_results_export (cognitive 17) web/components/analysis_results.py:890— analysis_results.render_results_export has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 1 (4 pts), loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.config (cognitive 16) cli/main.py:1623— main.config has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10, if/else 3 (5 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.
DataSourceManager.get_stock_info (cognitive 16) tradingagents/dataflows/data_source_manager.py:616— DataSourceManager.get_stock_info has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataSourceManager._try_fallback_stock_info (cognitive 16) tradingagents/dataflows/data_source_manager.py:652— DataSourceManager._try_fallback_stock_info has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 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.
ImprovedHKStockProvider.get_company_name (cognitive 16) tradingagents/dataflows/improved_hk_utils.py:133— ImprovedHKStockProvider.get_company_name has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3, boolean chains 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.
OptimizedChinaDataProvider._get_real_financial_metrics (cognitive 16) tradingagents/dataflows/optimized_china_data.py:485— OptimizedChinaDataProvider._get_real_financial_metrics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RealtimeNewsAggregator.format_news_report (cognitive 16) tradingagents/dataflows/realtime_news_utils.py:602— RealtimeNewsAggregator.format_news_report has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 3 (5 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.
NewsRelevanceFilter.calculate_relevance_score (cognitive 16) tradingagents/utils/news_filter.py:51— NewsRelevanceFilter.calculate_relevance_score has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3, boolean chains 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.
analysis_results.render_analysis_results (cognitive 16) web/components/analysis_results.py:333— analysis_results.render_analysis_results has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4, boolean chains 1, error handling 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.
results_display.render_decision_summary (cognitive 16) web/components/results_display.py:142— results_display.render_decision_summary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 4 (6 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Near-duplicate member pair (144 shared lines) web/components/analysis_form.py:21— web/components/analysis_form.py:21-363 | web/components/batch_analysis_form.py:24-335 — These two members are variants of one another: 144 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (65 shared lines) tradingagents/agents/analysts/market_analyst.py:84— tradingagents/agents/analysts/market_analyst.py:84-263 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:13-179 — These two members are variants of one another: 65 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) cli/main.py:1782— cli/main.py:1782-1864 | examples/data_dir_config_demo.py:28-70 — 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 copy of a member (31 corresponding lines) · ×1
Edited copy of a member (31 corresponding lines) tradingagents/dataflows/interface.py:124— tradingagents/dataflows/interface.py:124-154 | tradingagents/dataflows/interface.py:165-196 — 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 (99 corresponding lines) · ×1
Edited copy of a member (99 corresponding lines) upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:47— upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:47-145 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:47-145 — 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 (65 corresponding lines) · ×1
Edited copy of a member (65 corresponding lines) web/components/operation_logs.py:260— web/components/operation_logs.py:260-340 | web/components/user_activity_dashboard.py:117-181 — These two members are one piece of code written twice and then edited apart: 65 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) REDACTED:269— REDACTED:269-332 | REDACTED:455-492 — 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 copy of a member (67 corresponding lines) · ×1
Edited copy of a member (67 corresponding lines) REDACTED:25— REDACTED:25-98 | REDACTED:25-91 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) web/utils/progress_tracker.py:328— web/utils/progress_tracker.py:328-350 | web/utils/progress_tracker.py:354-375 — 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 (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) REDACTED:581— REDACTED:581-618 | REDACTED:464-497 — 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 copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) scripts/development/adaptive_cache_manager.py:244— scripts/development/adaptive_cache_manager.py:244-280 | REDACTED:233-269 — 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 copy of a member (91 corresponding lines) · ×1
Edited copy of a member (91 corresponding lines) cli/utils.py:146— cli/utils.py:146-236 | cli/utils.py:240-334 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) · ×1
Edited copy of a member (27 corresponding lines) tradingagents/llm_adapters/dashscope_openai_adapter.py:159— tradingagents/llm_adapters/dashscope_openai_adapter.py:159-185 | tradingagents/llm_adapters/google_openai_adapter.py:254-280 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×1
Edited copy of a member (25 corresponding lines) web/utils/file_session_manager.py:175— web/utils/file_session_manager.py:175-205 | REDACTED:124-148 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) web/utils/file_session_manager.py:89— web/utils/file_session_manager.py:89-126 | REDACTED:43-75 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 31+ corresponding lines) · ×1
Edited copies of one member (3 members, 31+ corresponding lines) web/utils/batch_report_exporter.py:59— web/utils/batch_report_exporter.py:59-89 | web/utils/batch_report_exporter.py:253-289 | web/utils/batch_report_exporter.py:292-337 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 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, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) web/utils/file_session_manager.py:129— web/utils/file_session_manager.py:129-153 | REDACTED:184-203 | REDACTED:78-102 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) scripts/development/adaptive_cache_manager.py:223— scripts/development/adaptive_cache_manager.py:223-240 | REDACTED:132-153 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) web/utils/smart_session_manager.py:45— web/utils/smart_session_manager.py:45-67 | web/utils/smart_session_manager.py:70-89 — 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 (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) tradingagents/config/database_manager.py:82— tradingagents/config/database_manager.py:82-118 | tradingagents/config/database_manager.py:121-152 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 22+ corresponding lines) · ×1
Edited copies of one member (3 members, 22+ corresponding lines) tradingagents/dataflows/interface.py:1092— tradingagents/dataflows/interface.py:1092-1118 | tradingagents/dataflows/interface.py:1151-1172 | tradingagents/dataflows/interface.py:1178-1199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 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) tradingagents/config/config_manager.py:321— tradingagents/config/config_manager.py:321-327 | tradingagents/config/config_manager.py:340-346 | tradingagents/config/config_manager.py:361-367 — 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 (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) web/utils/file_session_manager.py:254— web/utils/file_session_manager.py:254-270 | REDACTED:289-301 | REDACTED:187-199 | web/utils/smart_session_manager.py:174-190 — 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 copy of a member (16 corresponding lines) · ×1
Edited copy of a member (16 corresponding lines) REDACTED:70— REDACTED:70-88 | scripts/development/adaptive_cache_manager.py:171-186 — 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 (17 corresponding lines) · ×1
Edited copy of a member (17 corresponding lines) REDACTED:108— REDACTED:108-129 | scripts/development/adaptive_cache_manager.py:204-220 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×1
Edited copy of a member (11 corresponding lines) scripts/development/adaptive_cache_manager.py:150— scripts/development/adaptive_cache_manager.py:150-160 | REDACTED:49-59 — 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) · ×1
Edited copy of a member (3 corresponding lines) scripts/development/adaptive_cache_manager.py:145— scripts/development/adaptive_cache_manager.py:145-147 | REDACTED:44-46 — 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.
Duplicated block (83–85 lines × 2) web/components/analysis_form.py:134— web/components/analysis_form.py:134-218 | web/components/batch_analysis_form.py:124-206 — before extracting anything, compare `web/components/analysis_form.py` and `web/components/batch_analysis_form.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22–71 lines × 5) tradingagents/agents/analysts/china_market_analyst.py:100— tradingagents/agents/analysts/china_market_analyst.py:100-154 | tradingagents/agents/analysts/china_market_analyst.py:209-266 | tradingagents/agents/analysts/fundamentals_analyst.py:195-216 | tradingagents/agents/analysts/market_analyst.py:343-377 | tradingagents/agents/analysts/social_media_analyst.py:102-172 — before extracting anything, compare `tradingagents/agents/analysts/china_market_analyst.py` and `tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 156 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 `tradingagents/agents/analysts/china_market_analyst.py:100` 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, `tradingagents/agents/analysts/china_market_analyst.py:155` calls `partial` and `tradingagents/agents/analysts/china_market_analyst.py:268` 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 (69 lines × 2) REDACTED:176— REDACTED:176-244 | REDACTED:176-244 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (63 lines × 3) tradingagents/dataflows/optimized_us_data.py:47— tradingagents/dataflows/optimized_us_data.py:47-109 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:47-109 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:47-109 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (52–61 lines × 5) tradingagents/agents/analysts/china_market_analyst.py:14— tradingagents/agents/analysts/china_market_analyst.py:14-74 | tradingagents/agents/analysts/fundamentals_analyst.py:21-81 | tradingagents/agents/analysts/market_analyst.py:20-80 | tradingagents/agents/analysts/news_analyst.py:36-87 | tradingagents/agents/analysts/social_media_analyst.py:15-75 — before extracting anything, compare `tradingagents/agents/analysts/china_market_analyst.py` and `tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 156 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 (54 lines × 2) REDACTED:257— REDACTED:257-310 | REDACTED:257-310 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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–50 lines × 2) upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:357— upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:357-370 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:236-285 — before extracting anything, compare `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py` and `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 116 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 `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:357` 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 (43 lines × 2) REDACTED:315— REDACTED:315-357 | REDACTED:315-357 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (55 lines × 2) REDACTED:357— REDACTED:357-411 | REDACTED:267-321 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (39 lines × 2) web/app.py:1024— web/app.py:1024-1062 | web/app.py:1631-1669 — both copies are in the same file, so extract the 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 `web/app.py:1024` 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 (38 lines × 2) REDACTED:413— REDACTED:413-450 | REDACTED:413-450 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (36–37 lines × 2) cli/main.py:1822— cli/main.py:1822-1857 | examples/data_dir_config_demo.py:34-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.
Duplicated block (36 lines × 3) tradingagents/dataflows/optimized_us_data.py:145— tradingagents/dataflows/optimized_us_data.py:145-180 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:110-145 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:110-145 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (36 lines × 2) web/utils/report_exporter.py:334— web/utils/report_exporter.py:334-369 | web/utils/report_exporter.py:603-638 — both copies are in the same file, so extract the 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 (12–35 lines × 4) tradingagents/agents/managers/research_manager.py:19— tradingagents/agents/managers/research_manager.py:19-53 | tradingagents/agents/managers/risk_manager.py:22-35 | tradingagents/agents/researchers/bear_researcher.py:33-44 | tradingagents/agents/researchers/bull_researcher.py:44-55 — 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. 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 (35 lines × 3) tradingagents/dataflows/optimized_us_data.py:269— tradingagents/dataflows/optimized_us_data.py:269-303 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:234-268 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:234-268 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (33 lines × 3) web/components/operation_logs.py:363— web/components/operation_logs.py:363-395 | web/components/operation_logs.py:420-452 | web/components/operation_logs.py:474-506 — 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 (29 lines × 3) tradingagents/dataflows/interface.py:789— tradingagents/dataflows/interface.py:789-817 | tradingagents/dataflows/interface.py:824-852 | tradingagents/dataflows/interface.py:1040-1068 — 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 (26 lines × 3) tradingagents/agents/analysts/market_analyst.py:110— tradingagents/agents/analysts/market_analyst.py:110-135 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:37-62 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:38-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (40 lines × 2) REDACTED:513— REDACTED:513-552 | REDACTED:396-435 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (24–25 lines × 6) REDACTED:230— REDACTED:230-254 | REDACTED:385-408 | REDACTED:436-460 | REDACTED:230-254 | REDACTED:385-408 | REDACTED:436-460 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 442 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (49 lines × 3) tradingagents/dataflows/optimized_us_data.py:184— tradingagents/dataflows/optimized_us_data.py:184-232 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:149-197 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:149-197 — before extracting anything, compare `tradingagents/dataflows/optimized_us_data.py` and `upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 243 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22–25 lines × 2) web/components/analysis_form.py:98— web/components/analysis_form.py:98-119 | web/components/batch_analysis_form.py:76-100 — before extracting anything, compare `web/components/analysis_form.py` and `web/components/batch_analysis_form.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 148 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 `web/components/batch_analysis_form.py:76` 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 (24–25 lines × 2) web/utils/batch_report_exporter.py:66— web/utils/batch_report_exporter.py:66-89 | web/utils/batch_report_exporter.py:127-151 — both copies are in the same file, so extract the 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 (23–24 lines × 4) tradingagents/dataflows/optimized_china_data.py:1064— tradingagents/dataflows/optimized_china_data.py:1064-1087 | tradingagents/dataflows/optimized_us_data.py:244-266 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:209-231 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:209-231 — 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.
Duplicated block (23–24 lines × 3) tradingagents/agents/analysts/china_market_analyst.py:154— tradingagents/agents/analysts/china_market_analyst.py:154-176 | tradingagents/agents/analysts/market_analyst.py:378-401 | tradingagents/agents/analysts/social_media_analyst.py:172-195 — before extracting anything, compare `tradingagents/agents/analysts/china_market_analyst.py` and `tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 156 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 `tradingagents/agents/analysts/china_market_analyst.py:154` 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, `tradingagents/agents/analysts/market_analyst.py:377` calls `partial` and `tradingagents/agents/analysts/china_market_analyst.py:153` 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 (22–23 lines × 2) web/utils/report_exporter.py:642— web/utils/report_exporter.py:642-663 | web/utils/report_exporter.py:855-877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (22 lines × 2) tradingagents/agents/analysts/market_analyst.py:230— tradingagents/agents/analysts/market_analyst.py:230-251 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:158-179 — before extracting anything, compare `tradingagents/agents/analysts/market_analyst.py` and `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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, `upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:180` calls `error` and `tradingagents/agents/analysts/market_analyst.py:251` 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 (14–21 lines × 3) tradingagents/agents/utils/memory.py:136— tradingagents/agents/utils/memory.py:136-156 | tradingagents/agents/utils/memory.py:170-183 | tradingagents/agents/utils/memory.py:291-304 — 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 after the matched lines, `tradingagents/agents/utils/memory.py:186` calls `getenv`, `lower` and `tradingagents/agents/utils/memory.py:160` 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 (37 lines × 3) tradingagents/dataflows/interface.py:207— tradingagents/dataflows/interface.py:207-243 | tradingagents/dataflows/interface.py:254-290 | tradingagents/dataflows/interface.py:301-337 — 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 (20–21 lines × 2) REDACTED:311— REDACTED:311-331 | REDACTED:222-241 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:310` calls `mkdir` and `REDACTED:221` 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 (17 lines × 3) tradingagents/agents/analysts/market_analyst.py:86— tradingagents/agents/analysts/market_analyst.py:86-102 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:14-30 | upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/market_analyst.py:14-30 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (15–17 lines × 3) web/components/async_progress_display.py:123— web/components/async_progress_display.py:123-139 | web/components/async_progress_display.py:259-275 | web/components/async_progress_display.py:508-522 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–17 lines × 2) REDACTED:476— REDACTED:476-492 | REDACTED:360-375 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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, `REDACTED:475` calls `mkdir` and `REDACTED:359` 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 (16 lines × 4) web/components/async_progress_display.py:286— web/components/async_progress_display.py:286-301 | web/components/async_progress_display.py:422-437 | web/components/async_progress_display.py:482-497 | web/components/async_progress_display.py:591-606 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–15 lines × 4) web/components/operation_logs.py:89— web/components/operation_logs.py:89-103 | web/components/operation_logs.py:369-380 | web/components/operation_logs.py:426-437 | web/components/operation_logs.py:480-491 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–14 lines × 4) tradingagents/agents/utils/memory.py:141— tradingagents/agents/utils/memory.py:141-154 | tradingagents/agents/utils/memory.py:171-181 | tradingagents/agents/utils/memory.py:265-275 | tradingagents/agents/utils/memory.py:292-302 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–14 lines × 2) web/components/analysis_form.py:260— web/components/analysis_form.py:260-270 | web/components/analysis_form.py:314-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `web/components/analysis_form.py:271` calls `debug` and `web/components/analysis_form.py:328` 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 (11–12 lines × 5) tradingagents/dataflows/optimized_china_data.py:142— tradingagents/dataflows/optimized_china_data.py:142-152 | tradingagents/dataflows/optimized_china_data.py:1067-1078 | tradingagents/dataflows/optimized_us_data.py:247-257 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:212-222 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:212-222 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tradingagents/dataflows/optimized_china_data.py:153` calls `is_cache_valid` and `tradingagents/dataflows/optimized_china_data.py:1079` 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 (13 lines × 4) REDACTED:391— REDACTED:391-403 | REDACTED:532-544 | REDACTED:301-313 | REDACTED:415-427 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9–12 lines × 2) tradingagents/agents/utils/agent_utils.py:856— tradingagents/agents/utils/agent_utils.py:856-867 | tradingagents/agents/utils/agent_utils.py:947-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–12 lines × 2) web/components/operation_logs.py:229— web/components/operation_logs.py:229-239 | web/components/operation_logs.py:280-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–12 lines × 2) web/components/user_activity_dashboard.py:84— web/components/user_activity_dashboard.py:84-93 | web/components/user_activity_dashboard.py:377-388 — both copies are in the same file, so extract the block into 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 × 6) tradingagents/dataflows/optimized_china_data.py:620— tradingagents/dataflows/optimized_china_data.py:620-630 | tradingagents/dataflows/optimized_china_data.py:632-641 | tradingagents/dataflows/optimized_china_data.py:643-652 | tradingagents/dataflows/optimized_china_data.py:654-663 | tradingagents/dataflows/optimized_china_data.py:665-675 | tradingagents/dataflows/optimized_china_data.py:676-686 — 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. 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 × 4) web/components/analysis_results.py:705— web/components/analysis_results.py:705-715 | web/components/analysis_results.py:794-804 | web/components/operation_logs.py:325-335 | web/components/user_activity_dashboard.py:166-176 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `web/components/analysis_results.py:705` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) tradingagents/dataflows/realtime_news_utils.py:181— tradingagents/dataflows/realtime_news_utils.py:181-191 | tradingagents/dataflows/realtime_news_utils.py:232-242 | tradingagents/dataflows/realtime_news_utils.py:287-297 — 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 `tradingagents/dataflows/realtime_news_utils.py:181` 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, `tradingagents/dataflows/realtime_news_utils.py:231` calls `get` and `tradingagents/dataflows/realtime_news_utils.py:180` 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 lines × 3) web/components/analysis_results.py:501— web/components/analysis_results.py:501-512 | web/components/operation_logs.py:348-359 | web/components/user_activity_dashboard.py:189-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 all 3 call sites, so a change lands once.
Duplicated block (8–10 lines × 9) cli/main.py:1760— cli/main.py:1760-1767 | cli/main.py:2007-2014 | examples/demo_deepseek_analysis.py:221-229 | examples/simple_analysis_demo.py:65-74 | scripts/build_docker_with_pdf.py:139-146 | scripts/deployment/create_github_release.py:135-142 | scripts/deployment/release_v0.1.2.py:167-174 | scripts/deployment/release_v0.1.3.py:170-177 | scripts/setup-docker.py:73-81 — there are 9 copies across 8 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 9 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cli/main.py:1757` calls `debug`, `warning` and `examples/demo_deepseek_analysis.py:219` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 10) cli/main.py:1760— cli/main.py:1760-1767 | cli/main.py:2006-2013 | examples/demo_deepseek_analysis.py:221-228 | examples/simple_analysis_demo.py:65-72 | scripts/build_docker_with_pdf.py:138-146 | scripts/deployment/create_github_release.py:134-142 | scripts/deployment/create_github_release.py:199-207 | scripts/deployment/release_v0.1.2.py:166-174 | scripts/deployment/release_v0.1.3.py:169-177 | scripts/setup-docker.py:70-78 — there are 10 copies across 8 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 10 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cli/main.py:1757` calls `debug`, `warning` and `examples/demo_deepseek_analysis.py:219` 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–9 lines × 8) web/app.py:2128— web/app.py:2128-2136 | web/app.py:2137-2145 | web/app.py:2150-2158 | web/app.py:2163-2171 | web/app.py:2176-2184 | web/app.py:2189-2197 | web/app.py:2202-2210 | web/app.py:2214-2219 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. 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, `web/app.py:2136` calls `success`, `_download_button` and `web/app.py:2219` 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–9 lines × 4) REDACTED:177— REDACTED:177-185 | REDACTED:165-171 | REDACTED:105-113 | REDACTED:165-171 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 335 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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–9 lines × 2) tradingagents/agents/utils/google_tool_handler.py:631— tradingagents/agents/utils/google_tool_handler.py:631-638 | tradingagents/agents/utils/google_tool_handler.py:645-653 — both copies are in the same file, so extract the 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 (3–8 lines × 3) web/components/analysis_results.py:613— web/components/analysis_results.py:613-618 | web/components/analysis_results.py:990-997 | web/components/analysis_results.py:1183-1185 — 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 `web/components/analysis_results.py:990` 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.
Duplicated block (7 lines × 3) tradingagents/dataflows/realtime_news_utils.py:172— tradingagents/dataflows/realtime_news_utils.py:172-179 | tradingagents/dataflows/realtime_news_utils.py:224-230 | tradingagents/dataflows/realtime_news_utils.py:279-285 — 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 `tradingagents/dataflows/realtime_news_utils.py:172` 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 (5 lines × 11) web/components/sidebar.py:274— web/components/sidebar.py:274-279 | web/components/sidebar.py:307-312 | web/components/sidebar.py:335-340 | web/components/sidebar.py:381-386 | web/components/sidebar.py:414-418 | web/components/sidebar.py:470-475 | web/components/sidebar.py:576-581 | web/components/sidebar.py:696-701 | web/components/sidebar.py:743-748 | web/components/sidebar.py:790-795 | web/components/sidebar.py:841-846 — all 11 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) tradingagents/dataflows/optimized_china_data.py:24— tradingagents/dataflows/optimized_china_data.py:24-29 | tradingagents/dataflows/optimized_us_data.py:26-31 | upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py:26-31 | upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.py:26-31 — 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.
Near-duplicate member pair (45 shared lines) examples/dashscope_examples/demo_dashscope.py:27— examples/dashscope_examples/demo_dashscope.py:27-135 | examples/dashscope_examples/demo_dashscope_no_memory.py:27-122 — These two members are variants of one another: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (66 corresponding lines) · ×1
Edited copy of a member (66 corresponding lines) scripts/convert_prints_to_logs.py:72— scripts/convert_prints_to_logs.py:72-137 | scripts/fix_logging_imports.py:37-118 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) scripts/convert_prints_to_logs.py:270— scripts/convert_prints_to_logs.py:270-304 | scripts/fix_logging_imports.py:198-232 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×1
Edited copy of a member (26 corresponding lines) scripts/analyze_data_calls.py:32— scripts/analyze_data_calls.py:32-57 | scripts/log_analyzer.py:31-59 — 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 copies of one member (3 members, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) scripts/convert_prints_to_logs.py:189— scripts/convert_prints_to_logs.py:189-226 | scripts/fix_logging_imports.py:121-154 | scripts/migrate_to_unified_logging.py:42-79 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 19+ corresponding lines) · ×1
Edited copies of one member (4 members, 19+ corresponding lines) scripts/development/organize_scripts.py:249— scripts/development/organize_scripts.py:249-267 | scripts/maintenance/finalize_script_organization.py:318-339 | scripts/maintenance/organize_root_scripts.py:214-234 | scripts/setup/configure_pip_source.py:200-225 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) scripts/convert_prints_to_logs.py:248— scripts/convert_prints_to_logs.py:248-265 | scripts/fix_logging_imports.py:176-193 | scripts/migrate_to_unified_logging.py:230-255 — 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 copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) scripts/deployment/release_v0.1.2.py:33— scripts/deployment/release_v0.1.2.py:33-47 | scripts/deployment/release_v0.1.3.py:33-49 | scripts/deployment/release_v0.1.3.py:149-165 — 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, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) scripts/diagnose_empty_data.py:221— scripts/diagnose_empty_data.py:221-246 | scripts/fix_docker_logging.py:241-266 | scripts/fix_logging_config_error.py:253-278 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 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 (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) scripts/setup/initialize_system.py:315— scripts/setup/initialize_system.py:315-324 | scripts/validation/check_system_status.py:243-252 — 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.
Duplicated block (59–60 lines × 2) scripts/convert_prints_to_logs.py:78— scripts/convert_prints_to_logs.py:78-137 | scripts/fix_logging_imports.py:60-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (31–41 lines × 2) examples/demo_deepseek_analysis.py:47— examples/demo_deepseek_analysis.py:47-77 | examples/demo_deepseek_analysis.py:80-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–17 lines × 2) scripts/quick_syntax_check.py:21— scripts/quick_syntax_check.py:21-33 | scripts/syntax_checker.py:21-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 4) scripts/install_pandoc.py:85— scripts/install_pandoc.py:85-98 | scripts/install_pandoc.py:108-121 | scripts/install_pdf_tools.py:69-82 | scripts/install_pdf_tools.py:90-103 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/install_pandoc.py:85` 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) scripts/analyze_data_calls.py:364— scripts/analyze_data_calls.py:364-377 | scripts/log_analyzer.py:355-368 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 2) scripts/setup/initialize_system.py:166— scripts/setup/initialize_system.py:166-176 | scripts/validation/check_system_status.py:78-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6–10 lines × 3) scripts/development/fix_streamlit_watcher.py:42— scripts/development/fix_streamlit_watcher.py:42-51 | scripts/development/fix_streamlit_watcher.py:53-62 | scripts/development/fix_streamlit_watcher.py:63-68 — 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. 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 (8 lines × 6) scripts/install_pandoc.py:73— scripts/install_pandoc.py:73-80 | scripts/install_pandoc.py:89-96 | scripts/install_pandoc.py:112-119 | scripts/install_pdf_tools.py:57-64 | scripts/install_pdf_tools.py:73-80 | scripts/install_pdf_tools.py:94-101 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/install_pandoc.py:73` 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 (8 lines × 3) examples/dashscope_examples/demo_dashscope.py:39— examples/dashscope_examples/demo_dashscope.py:39-46 | examples/dashscope_examples/demo_dashscope.py:109-116 | examples/dashscope_examples/demo_dashscope_no_memory.py:94-102 — before extracting anything, compare `examples/dashscope_examples/demo_dashscope.py` and `examples/dashscope_examples/demo_dashscope_no_memory.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 10) scripts/install_pandoc.py:73— scripts/install_pandoc.py:73-79 | scripts/install_pandoc.py:89-95 | scripts/install_pandoc.py:112-118 | scripts/install_pandoc.py:137-143 | scripts/install_pandoc.py:153-159 | scripts/install_pdf_tools.py:57-63 | scripts/install_pdf_tools.py:73-79 | scripts/install_pdf_tools.py:94-100 | scripts/install_pdf_tools.py:117-123 | scripts/install_pdf_tools.py:133-139 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/install_pandoc.py:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/install_pandoc.py:136` calls `run` and `scripts/install_pandoc.py:72` 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 × 5) scripts/install_pandoc.py:83— scripts/install_pandoc.py:83-89 | scripts/install_pandoc.py:106-112 | scripts/install_pandoc.py:129-135 | scripts/install_pdf_tools.py:67-73 | scripts/install_pdf_tools.py:88-94 — before extracting anything, compare `scripts/install_pandoc.py` and `scripts/install_pdf_tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/install_pandoc.py:136` calls `run` and `scripts/install_pandoc.py:90` 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.
Low cohesion: MessageBuffer (LCOM4 4) cli/main.py:152— MessageBuffer'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.
Interpolated log message defeats structured logging web/app.py:369— `info` at line 369 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 web/app.py:372— `warning` at line 372 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 web/app.py:385— `info` at line 385 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 web/app.py:395— `warning` at line 395 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 web/app.py:400— `warning` at line 400 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 web/app.py:415— `warning` at line 415 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 web/app.py:422— `info` at line 422 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 web/app.py:423— `info` at line 423 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 web/app.py:437— `warning` at line 437 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 web/app.py:463— `info` at line 463 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 web/app.py:464— `info` at line 464 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 web/app.py:470— `info` at line 470 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 web/app.py:484— `warning` at line 484 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 web/app.py: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 web/app.py:617— `warning` at line 617 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 web/app.py:923— `warning` at line 923 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 web/app.py:1149— `debug` at line 1149 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging web/app.py:1150— `debug` at line 1150 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging web/app.py:1151— `debug` at line 1151 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.debug("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.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging web/app.py:1182— `warning` at line 1182 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 web/app.py:1290— `info` at line 1290 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 web/app.py:1292— `warning` at line 1292 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 web/app.py:1295— `error` at line 1295 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.error("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.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging web/app.py:1297— `info` at line 1297 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 web/app.py:1315— `info` at line 1315 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.
Duplicated predicate web/utils/async_progress_tracker.py:339— `"分析完成" in message or "分析成功" in message or "✅ 分析完成" in message` appears character-identically in 2 files — web/utils/async_progress_tracker.py, web/utils/progress_tracker.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 web/utils/async_progress_tracker.py:400— `"环境" in message or "api" in message_lower or "密钥" in message` appears character-identically in 2 files — web/utils/async_progress_tracker.py, web/utils/progress_tracker.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 web/utils/async_progress_tracker.py:397— `"验证" in message or "预获取" in message or "数据准备" in message` appears character-identically in 2 files — web/utils/async_progress_tracker.py, web/utils/progress_tracker.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 web/components/analysis_form.py:142— `'social' not in cached_analysts and len(cached_analysts) <= 2` appears character-identically in 2 files — web/components/analysis_form.py, web/components/batch_analysis_form.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 tradingagents/llm/deepseek_adapter.py:48— `api_key or os.getenv("DEEPSEEK_API_KEY")` appears character-identically in 2 files — tradingagents/llm/deepseek_adapter.py, tradingagents/llm_adapters/deepseek_direct_adapter.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:364— `balance_sheet is not None and not balance_sheet.empty` appears character-identically in 2 files — REDACTED, tradingagents/dataflows/tushare_utils.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:388— `cash_flow is not None and not cash_flow.empty` appears character-identically in 2 files — REDACTED, tradingagents/dataflows/tushare_utils.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:399— `data_source is None or metadata.get('data_source') == data_source` 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 tradingagents/dataflows/optimized_us_data.py:96— `formatted_data and "❌" not in formatted_data` appears character-identically in 3 files — tradingagents/dataflows/optimized_us_data.py, upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py, upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.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 tradingagents/dataflows/tushare_adapter.py:134— `hasattr(cached_data, 'empty') and not cached_data.empty` appears character-identically in 2 files — tradingagents/dataflows/tushare_adapter.py, tradingagents/dataflows/tushare_utils.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 tradingagents/llm_adapters/dashscope_openai_adapter.py:228— `hasattr(response, 'tool_calls') and response.tool_calls` appears character-identically in 2 files — tradingagents/llm_adapters/dashscope_openai_adapter.py, tradingagents/llm_adapters/google_openai_adapter.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 tradingagents/llm_adapters/dashscope_openai_adapter.py:62— `hasattr(result, 'llm_output') and result.llm_output` appears character-identically in 3 files — tradingagents/llm_adapters/dashscope_openai_adapter.py, tradingagents/llm_adapters/deepseek_adapter.py, tradingagents/llm_adapters/google_openai_adapter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/install_and_run.py:16— `hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix` appears character-identically in 2 files — scripts/install_and_run.py, start_web.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:376— `income_statement is not None and not income_statement.empty` appears character-identically in 2 files — REDACTED, tradingagents/dataflows/tushare_utils.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 tradingagents/dataflows/tushare_adapter.py:139— `isinstance(cached_data, str) and cached_data.strip()` appears character-identically in 2 files — tradingagents/dataflows/tushare_adapter.py, tradingagents/dataflows/tushare_utils.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 tradingagents/api/stock_api.py:86— `isinstance(result, dict) and 'error' in result` appears character-identically in 2 files — tradingagents/api/stock_api.py, tradingagents/dataflows/stock_api.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 tradingagents/dataflows/optimized_us_data.py:253— `metadata.get('symbol') == symbol and metadata.get('data_type') == 'stock_data' and metadata.get('market_type') == 'us'` appears character-identically in 3 files — tradingagents/dataflows/optimized_us_data.py, upstream_contribution/batch1_caching/tradingagents/dataflows/optimized_us_data.py, upstream_contribution/batch3_data_sources/tradingagents/dataflows/optimized_us_data.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:61— `mongodb_url or os.getenv("MONGODB_URL", f"mongodb://admin:{mongodb_password}@localhost:{mongodb_port}")` 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 web/components/operation_logs.py:156— `not auth_manager or not auth_manager.check_permission("admin")` appears character-identically in 3 files — web/components/operation_logs.py, web/components/user_activity_dashboard.py, web/modules/member_management.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/development/adaptive_cache_manager.py:294— `not cache_data and self.fallback_enabled` appears character-identically in 2 files — scripts/development/adaptive_cache_manager.py, 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 scripts/convert_prints_to_logs.py:99— `not stripped or stripped.startswith('#')` appears character-identically in 4 files — scripts/convert_prints_to_logs.py, scripts/fix_duplicate_loggers.py, scripts/fix_logger_position.py, scripts/fix_logging_imports.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/convert_prints_to_logs.py:90— `not stripped.endswith(docstring_char) or len(stripped) == 3` appears character-identically in 2 files — scripts/convert_prints_to_logs.py, scripts/fix_logging_imports.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/install_pdf_tools.py:193— `os.path.exists(output_file) and os.path.getsize(output_file) > 0` appears character-identically in 3 files — scripts/install_pdf_tools.py, web/utils/docker_pdf_adapter.py, web/utils/report_exporter.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:62— `redis_url or os.getenv("REDIS_URL", f"redis://:{redis_password}@localhost:{redis_port}")` 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 tradingagents/agents/managers/risk_manager.py:66— `response and hasattr(response, 'content') and response.content` appears character-identically in 3 files — tradingagents/agents/managers/risk_manager.py, tradingagents/llm_adapters/dashscope_openai_adapter.py, tradingagents/llm_adapters/google_openai_adapter.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.
README/code drift docs/README.md:24— docs/README.md links to `./architecture/system-architecture.md`, but `docs/architecture/system-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:25— docs/README.md links to `./architecture/containerization-architecture.md`, but `docs/architecture/containerization-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:26— docs/README.md links to `./architecture/database-architecture.md`, but `docs/architecture/database-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:27— docs/README.md links to `./architecture/agent-architecture.md`, but `docs/architecture/agent-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:28— docs/README.md links to `./architecture/data-flow-architecture.md`, but `docs/architecture/data-flow-architecture.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:29— docs/README.md links to `./architecture/graph-structure.md`, but `docs/architecture/graph-structure.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:30— docs/README.md links to `./architecture/configuration-optimization.md`, but `docs/architecture/configuration-optimization.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:33— docs/README.md links to `./agents/analysts.md`, but `docs/agents/analysts.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:34— docs/README.md links to `./agents/researchers.md`, but `docs/agents/researchers.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:35— docs/README.md links to `./agents/trader.md`, but `docs/agents/trader.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:36— docs/README.md links to `./agents/risk-management.md`, but `docs/agents/risk-management.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:37— docs/README.md links to `./agents/managers.md`, but `docs/agents/managers.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:49— docs/README.md links to `./features/multi-llm-integration.md`, but `docs/features/multi-llm-integration.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:50— docs/README.md links to `./features/model-persistence.md`, but `docs/features/model-persistence.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:59— docs/README.md links to `./configuration/openrouter-config.md`, but `docs/configuration/openrouter-config.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:75— docs/README.md links to `./development/dev-setup.md`, but `docs/development/dev-setup.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:76— docs/README.md links to `./development/code-structure.md`, but `docs/development/code-structure.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:77— docs/README.md links to `./development/extending.md`, but `docs/development/extending.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:78— docs/README.md links to `./development/testing.md`, but `docs/development/testing.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:87— docs/README.md links to `./api/core-api.md`, but `docs/api/core-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:88— docs/README.md links to `./api/agents-api.md`, but `docs/api/agents-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:89— docs/README.md links to `./api/data-api.md`, but `docs/api/data-api.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:92— docs/README.md links to `./guides/NEWS_FILTERING_USER_GUIDE.md`, but `docs/guides/NEWS_FILTERING_USER_GUIDE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:93— docs/README.md links to `./guides/multi-llm-usage-guide.md`, but `docs/guides/multi-llm-usage-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/README.md:94— docs/README.md links to `./guides/model-persistence-guide.md`, but `docs/guides/model-persistence-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
+ 6 more in this group — see findings.md.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×11
Diagnostic log message is built whether or not it is wanted web/components/analysis_form.py:289— `debug` at line 289 is called with an argument built by `[a[0] for a in selected_analysts]` (line 289), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted web/components/batch_analysis_form.py:268— `debug` at line 268 is called with an argument built by `[a[0] for a in selected_analysts]` (line 268), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted web/components/results_display.py:248— `debug` at line 248 is called with an argument built by `list(decision.keys())` (line 248), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:277— `debug` at line 277 is called with an argument built by `[tool.name for tool in tools]` (line 277), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted upstream_contribution/batch2_error_handling/tradingagents/agents/analysts/fundamentals_analyst.py:282— `debug` at line 282 is called with an argument built by `[tool.name for tool in tools]` (line 282), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted REDACTED:354— `debug` at line 354 is called with an argument built by `list(main_indicators.columns)` (line 354), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted tradingagents/dataflows/optimized_china_data.py:195— `debug` at line 195 is called with an argument built by `list(str(symbol))` (line 195), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted tradingagents/dataflows/optimized_china_data.py:397— `debug` at line 397 is called with an argument built by `list(str(symbol))` (line 397), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted tradingagents/agents/utils/google_tool_handler.py:63— `debug` at line 63 is called with an argument built by `[attr for attr in dir(result) if not attr.startswith("…")]` (line 63), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted tradingagents/agents/utils/google_tool_handler.py:74— `debug` at line 74 is called with an argument built by `[attr for attr in dir(result) if not attr.startswith("…")]` (line 74), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted tradingagents/agents/utils/google_tool_handler.py:350— `debug` at line 350 is called with an argument built by `[attr for attr in dir(final_result) if not attr.startswith("…")]` (line 350), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Silent fallback default in catch web/components/analysis_results.py:67— `load_favorites` 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 web/components/analysis_results.py:88— `load_tags` 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 web/utils/license_manager.py:20— `_load_license` 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 web/utils/license_manager.py:43— `_generate_machine_code` swallows every exception into `return '0000000000'` — 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.
No ADRs found pyproject.toml:56— 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 56).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion pyproject.toml:1— `(repository root)` (57601 LoC, 301 module-visible types across 35 directories) overshoots its size bounds. 1 of 2 build unit(s) (Python) overshoot their size bounds, lowering Project Cohesion to 0.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.
Thin README README.md:1— The root README is 3 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers.
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.
No src/ separation — Most of the production code is in directories of its own, but 7 application file(s) sit at the repository root beside the build and tooling files (`demo_batch_analysis.py`, `main.py`, `start_web.py`, `test_batch_analysis.py`, `test_fix.py` and 2 more).
P1 · CI/CD gates· CI build step not evidenced · ×1
CI build step not evidenced — A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.
No SAST — 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 1 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.
No dependency-update automation pyproject.toml:11— `pyproject.toml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 39 shipped distribution(s) across 2 manifest(s) (1 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, REDACTED, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.
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.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
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.
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.
Run 01a1eaa2-a537-757c-9dca-f651022bce6d · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 56 · Warnings: 820 · Recommendations: 129 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 17:51 UTC.
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.