Public report — hftbacktest, published 30 Sep 2026. Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches, dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase survey Measured under the Code Assurance Index · rubric rubric-2026.09.18 (frozen) · verify this survey Filed cd_46d7a1e990b544199871ebfefc191f96 Filed 30 September 2026, 08:30 UTC Public

Nkaz001/hftbacktest

Measured 30 September 2026, 08:28 UTC

63% Adequate
CriticalWeakAdequateStrongExemplary

Medium · 29,760 LoC · 6 projects · rebuild ~0.2 person-years · weakest lens: Readiness (49%)

Findings by grade

32 critical 387 serious 15 minor 38 could not be resolved — could be critical — see Limitations

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
30 September 2026, 08:28 UTC

A measurement, not a certificate. The Code Assurance Index does not certify, approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said here so the number is checked rather than believed.

Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸

37/41dimensions tool-verifieddeterministic · confidence 1.0 · 4 LLM-assisted, advisory
419findings with an exact file:lineof 434 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
41/120dimensions across the health lenses29760 LoC · 6 projects — wide & deep
Chapters

Executive summary

The system holds an adequate standing with a health score of 63%, indicating a workable asset that carries manageable but distinct risks. While the underlying architecture is robust and the codebase is small enough to rebuild for roughly €36,000, the operational readiness is insufficient for confident, high-velocity delivery. This gap creates a tangible drag on the team’s ability to ship features reliably and securely.

The most critical vulnerability lies in operational readiness, which sits at 49%. This low score means the system lacks the automated safeguards and observability needed to prevent outages or slow down incident response. For a business, this translates to higher costs during failures and reduced trust in the platform’s stability. Addressing this area offers the highest protection for the business, as it directly impacts the reliability of every customer-facing interaction.

A secondary concern is the hidden velocity tax imposed by code quality. Although the architecture is sound, the code’s complexity and cohesion average a moderate 6.3 out of 10. This imperfection acts as a friction point, adding an estimated 4–10% extra effort to every change. Over time, this compounds, slowing down feature development and increasing the likelihood of defects. The cost of this inefficiency is paid annually in delayed releases, making it a recurring expense rather than a one-time fix.

Despite these risks, the system benefits from strong architectural foundations and a very small footprint, which limits the potential blast radius of any single failure. The code is also free of boilerplate, suggesting a focused and intentional design. These strengths provide a solid base for improvement without requiring a complete rewrite.

The immediate focus should be automating the release process in the CI pipeline. This single action pays for itself within months by making deployments repeatable and reversible, directly addressing the readiness gap. Once this foundation is secure, the team can systematically reduce the velocity tax by refactoring the most complex areas. This approach delivers quick wins while building long-term stability.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Readiness 49% · 46% weightMaturity 68% · 25% weightCode Health 75% · 14% weightSecurity 79% · 8% weightArchitecture 93% · 4% weightEvent Sourcing 100% · 2% weightPerformance 100% · 1% weight

Raise Readiness 49 → 70 (the Healthy floor) ⇒ headline 63 → ~73.

Code composition — where the lines go
Tests 100%
New since the last scan (24+)

24 finding(s) are new versus the previous scan (2026-09-14) — surfaced by this scheduled scan itself, no pull request required.

  • D4 · Members sharing a duplicated core (8 members, 50+ identical tokens) py-hftbacktest/hftbacktest/data/utils/binancefutures.py
  • D4 · Duplicated block (49 lines × 2) py-hftbacktest/hftbacktest/data/utils/binancefutures.py
  • D4 · Duplicated block (40–44 lines × 3) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py
  • D4 · Duplicated block (30–34 lines × 4) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py
  • D4 · Duplicated block (34 lines × 2) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (29 lines × 2) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (15–17 lines × 8) py-hftbacktest/hftbacktest/data/utils/binancefutures.py
  • D4 · Duplicated block (15–17 lines × 2) py-hftbacktest/hftbacktest/data/utils/bybit.py
  • D4 · Duplicated block (17 lines × 2) py-hftbacktest/hftbacktest/data/utils/bybit.py
  • D4 · Duplicated block (14 lines × 2) hftbacktest/examples/4_latency.py
  • D4 · Duplicated block (9–11 lines × 3) py-hftbacktest/hftbacktest/data/utils/binancefutures.py
  • D4 · Duplicated block (11 lines × 2) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (10 lines × 4) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (8–9 lines × 2) hftbacktest/examples/4_latency.py
  • D4 · Duplicated block (9 lines × 2) py-hftbacktest/hftbacktest/data/utils/hyperliquid.py
  • D4 · Duplicated block (7–8 lines × 5) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (8 lines × 3) py-hftbacktest/hftbacktest/data/utils/tardis.py
  • D4 · Duplicated block (10 lines × 3) examples/example_bybit.py
  • D6 · Low cohesion: RiskAdverseQueueModel (LCOM4 4) hftbacktest/src/backtest/models/queue.rs
  • D6 · Low cohesion: ProbQueueModel (LCOM4 4) hftbacktest/src/backtest/models/queue.rs
  • D22 · Redundant operations for setting cache entries. `insert` and `set` appear to perform the same function (storing data under a key), creating confusion about which to use or if they have different side effects (e.g., overwrite vs. ignore existing).
  • D22 · Inconsistent order submission API. `submit_buy_order` and `submit_sell_order` are convenience methods that duplicate the functionality of `submit_order` when an `OrderRequest` with a `Side` is provided. This forces users to choose between a verbose specific method or a generic one, and creates API surface bloat.
  • D22 · Conflicting accessors for the same property. `descr` is exposed as both a property returning a typed `DType` and a method returning a `String`. This is inconsistent with Rust conventions (properties are fields/getters, methods are actions) and creates ambiguity on how to access the description.
  • D22 · Ambiguous naming for time progression. `elapse` and `elapse_bt` (likely 'backtest') suggest similar functionality (advancing time), but the distinction is unclear from the names alone. It is not immediately obvious if `elapse_bt` is a specialized version or if one is deprecated.

A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.

Rebuild cost & value ~ Modeled — €12,000–€59,000
Cost to rebuild€12,000–€59,000 (0.1–0.4 person-years (197–626 h), ~1 engineer)
Domain complexityStandard — harder problems cost more per line
Quality factor0.9× (at 63% quality) — the last 20% of quality is most of the work
Size & shapeMedium · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)

This codebase represents roughly ~0.2 person-years of build effort (about ~€36,000 to rebuild). Its weakest lens is Readiness at 49% — the part of that asset most exposed by the findings below.

How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).

Top priorities

The highest-leverage moves; the full ranked list is in the Roadmap below.

1
Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.
+12.4 pts · Medium effort · Deployment & Rollback
2
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
+12.3 pts · Medium effort · Release Hygiene
3
Keep implementation types off the public surface (Rust: `pub(crate)`, or keep the module private) so internals can change without breaking consumers.
+11.8 pts · Medium effort · Library API & versioning

Diagnosis — what's actually going on

The top fix pays for itself · High · Economics
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 1.7–10.4 engineer-days every year, paid as drag on the ~16,433 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 3–69 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 4–10% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 4,052 line(s) changed over a 90-day window ⇒ ~16,433/year · D1/D2/D4/D6 code quality: averaging 6.3/10 ⇒ a 4–10% drag on each change · top-ranked remediation: Medium effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 69 months.
Value concentrated against a weak lens · Medium · Value at risk
This is a Medium asset (~0.2 person-years to rebuild), and its weakest lens is Readiness at 49%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
Evidence: valuation: Medium, ~0.2 person-years rebuild (29,760 LoC) · weakest lens: Readiness 49%
→ Direct remediation budget at Readiness first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 6.3/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 4–10% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4/D6 code quality: averaging 6.3/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch collector collector connector connector hftbacktest (Cargo) hftbacktest (Cargo) connector->hftbacktest (Cargo) hftbacktest-derive hftbacktest-derive hftbacktest (Cargo)->hftbacktest-derive hftbacktest (Python) hftbacktest (Python) py-hftbacktest py-hftbacktest py-hftbacktest->hftbacktest (Cargo) py-hftbacktest->hftbacktest-derive

Architecture — module dependency matrix

Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)

97 modules, 183 dependencies. 1 dependency cycle across 9 modules, marked above the diagonal.

Showing the 40 most-connected modules; 57 more are not drawn.

Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
depends on →1 collector.throttler2 hftbacktest.backtest.data3 connector.binancespot.rest4 connector.connector5 hftbacktest.backtest.models.queue6 connector.binancespot7 hftbacktest.backtest.data.npy.parser8 hftbacktest.types9 connector.binancefutures.msg.rest10 connector.binancefutures.msg.stream11 connector.binancefutures.rest12 connector.binancespot.msg.stream13 connector.bybit.msg14 connector.bybit.rest15 hftbacktest.backtest.data.reader16 hftbacktest.backtest.order17 hftbacktest.backtest.proc18 hftbacktest.backtest.recorder19 hftbacktest.backtest.state20 hftbacktest.depth21 connector.binancefutures22 connector.binancefutures.market_data_stream23 connector.binancespot.market_data_stream24 connector.binancespot.ordermanager25 connector.binancespot.user_data_stream26 connector.bybit.ordermanager27 hftbacktest.backtest28 hftbacktest.backtest.models.latency29 hftbacktest.backtest.proc.l3_local30 hftbacktest.backtest.proc.l3_nopartialfillexchange31 hftbacktest.backtest.proc.local32 hftbacktest.backtest.proc.nopartialfillexchange33 hftbacktest.backtest.proc.partialfillexchange34 hftbacktest.depth.btreemarketdepth35 hftbacktest.depth.fuse36 hftbacktest.depth.hashmapmarketdepth37 hftbacktest.depth.roivectormarketdepth38 connector.binancefutures.ordermanager39 connector.bybit40 py_hftbacktest
1 collector.throttler
2 hftbacktest.backtest.data
3 connector.binancespot.rest31
4 connector.connector3
5 hftbacktest.backtest.models.queue67
6 connector.binancespot1221
7 hftbacktest.backtest.data.npy.parser111
8 hftbacktest.types1224
9 connector.binancefutures.msg.rest4
10 connector.binancefutures.msg.stream5
11 connector.binancefutures.rest31
12 connector.binancespot.msg.stream141
13 connector.bybit.msg465
14 connector.bybit.rest1
15 hftbacktest.backtest.data.reader75
16 hftbacktest.backtest.order3
17 hftbacktest.backtest.proc52
18 hftbacktest.backtest.recorder111
19 hftbacktest.backtest.state11
20 hftbacktest.depth141
21 connector.binancefutures221
22 connector.binancefutures.market_data_stream121
23 connector.binancespot.market_data_stream1111
24 connector.binancespot.ordermanager111131
25 connector.binancespot.user_data_stream221
26 connector.bybit.ordermanager133
27 hftbacktest.backtest1655
28 hftbacktest.backtest.models.latency353
29 hftbacktest.backtest.proc.l3_local51121
30 hftbacktest.backtest.proc.l3_nopartialfillexchange12111
31 hftbacktest.backtest.proc.local51121
32 hftbacktest.backtest.proc.nopartialfillexchange12111
33 hftbacktest.backtest.proc.partialfillexchange12111
34 hftbacktest.depth.btreemarketdepth11214
35 hftbacktest.depth.fuse122
36 hftbacktest.depth.hashmapmarketdepth11214
37 hftbacktest.depth.roivectormarketdepth11214
38 connector.binancefutures.ordermanager11141
39 connector.bybit21211
40 py_hftbacktest1111
Dependency, pointing down the layeringAbove the diagonal — part of a cycleThe module itself
collector.throttler…acktest.backtest.data…ctor.binancespot.restconnector.connector…backtest.models.queueconnector.binancespot…ktest.data.npy.parserhftbacktest.types…nancefutures.msg.rest…ncefutures.msg.stream…r.binancefutures.rest…inancespot.msg.streamconnector.bybit.msgconnector.bybit.rest….backtest.data.reader…cktest.backtest.order…acktest.backtest.proc…est.backtest.recorder…cktest.backtest.statehftbacktest.depth…nector.binancefutures…es.market_data_stream…ot.market_data_stream…ancespot.ordermanager…spot.user_data_stream…or.bybit.ordermanagerhftbacktest.backtest…cktest.models.latency…acktest.proc.l3_local…nopartialfillexchange…t.backtest.proc.local…nopartialfillexchange…c.partialfillexchange…epth.btreemarketdepthhftbacktest.depth.fuse…th.hashmapmarketdepth….roivectormarketdepth…efutures.ordermanagerconnector.bybitpy_hftbacktestcollector.throttler1…acktest.backtest.data2…ctor.binancespot.rest3connector.connector4…backtest.models.queue5connector.binancespot6…ktest.data.npy.parser7hftbacktest.types8…nancefutures.msg.rest9…ncefutures.msg.stream10…r.binancefutures.rest11…inancespot.msg.stream12connector.bybit.msg13connector.bybit.rest14….backtest.data.reader15…cktest.backtest.order16…acktest.backtest.proc17…est.backtest.recorder18…cktest.backtest.state19hftbacktest.depth20…nector.binancefutures21…es.market_data_stream22…ot.market_data_stream23…ancespot.ordermanager24…spot.user_data_stream25…or.bybit.ordermanager26hftbacktest.backtest27…cktest.models.latency28…acktest.proc.l3_local29…nopartialfillexchange30…t.backtest.proc.local31…nopartialfillexchange32…c.partialfillexchange33…epth.btreemarketdepth34hftbacktest.depth.fuse35…th.hashmapmarketdepth36….roivectormarketdepth37…efutures.ordermanager38connector.bybit39py_hftbacktest40313671221111122445311414651753521111114122112111111111312211331655353511211211151121121111211111214122112141121411141212111111+57 more modules (most-connected shown)

At a glance — Code Health · 75% · Adequate · gated by D2 ·

At a glance — Architecture · 93% · Exemplary ·

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

At a glance — Readiness · 49% · Weak · gated by P4 ·

At a glance — Security · 79% · Adequate · gated by D36 ·

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

At a glance — Performance · 100% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A03:2021 — Injection31High / Critical

Roadmap

First, establish automated, repeatable, and reversible deployment pipelines to ensure safe and consistent releases. Second, maintain a clear changelog to track changes and keep internal implementation details private to protect public APIs from unintended breakage. Finally, enforce test gates in CI to block merges on failures and address the absence of architectural decision records to improve long-term system understanding.

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

Do thisHelpsEffortDimension
Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.+12.4 ptsMediumDeployment & Rollback
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+12.3 ptsMediumRelease Hygiene
Keep implementation types off the public surface (Rust: `pub(crate)`, or keep the module private) so internals can change without breaking consumers.+11.8 ptsMediumLibrary API & versioning
Resolve the 1 No ADRs found finding(s) in ADR Quality.+3.7 ptsLowADR Quality
Run the test suite in CI via an explicit runner step for your stack, and gate merges on it.+6.9 ptsMediumCI/CD gates
Resolve the 1 Orphaned files with no living knowledge finding(s) in Knowledge Freshness.+2.3 ptsLowKnowledge Freshness
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).+3.7 ptsMediumArchitecture documentation
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.+3.5 ptsMediumDocumentation (README)

File quality

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

FileScoreBandWorst signal
REDACTED1.6SlopStatic Analysis (SAST): High: REDACTED
connector/src/binancefutures/ordermanager.rs2.3SlopChange Coupling: Boundary-crossing change coupling: ordermanager.rs ↔ bot.rs
connector/src/bybit/mod.rs3.4SlopChange Coupling: Boundary-crossing change coupling: mod.rs ↔ bot.rs
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
connector/src/binancefutures/mod.rs5.0MixedChange Coupling: Boundary-crossing change coupling: mod.rs ↔ bot.rs
connector/src/binancefutures/rest.rs5.0MixedChange Coupling: Boundary-crossing change coupling: rest.rs ↔ bot.rs
hftbacktest/src/depth/btreemarketdepth.rs5.5MixedCognitive Complexity: BTreeMarketDepth::clear_depth (cognitive 31)
hftbacktest/src/backtest/proc/l3_local.rs5.5MixedCognitive Complexity: L3Local::process_recv_order (cognitive 25)
py-hftbacktest/hftbacktest/data/utils/binancefutures.py5.6MixedCyclomatic Complexity: binancefutures.convert (cyclomatic 21)
hftbacktest/src/backtest/proc/partialfillexchange.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/backtest/proc/nopartialfillexchange.rs6.0MixedExplicit Debt: TodoComment
connector/src/bybit/private_stream.rs6.0MixedExplicit Debt: TodoComment
connector/src/binancespot/user_data_stream.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/live/bot.rs6.0MixedExplicit Debt: FixmeComment
connector/src/binancefutures/user_data_stream.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs6.0MixedExplicit Debt: TodoComment
hftbacktest-derive/src/lib.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/backtest/models/queue.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/depth/fuse.rs6.0MixedExplicit Debt: TodoComment
hftbacktest/src/depth/hashmapmarketdepth.rs6.0MixedExplicit Debt: TodoComment

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 32

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

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

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

Could not be resolved — 38

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

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 37 of 41 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

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

What we checked — 41 dimensions across the health lenses
D1D2D3D4D5D6D9D13D14D15D17D19D20D21D22D26D28D29D30D34D35D36D43D44AX10AX3AX4AX9ES1ES2M1M2M3M4P1P10P2P3P4P6PF3

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 419 of 434 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a0f16e-5ae4-75b3-b78f-bb5046128aa4.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.py, .rs) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`, or lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.py, .rs) and this repository declares a Cargo test suite (repository root, 8 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 34 direct Cargo declaration(s) were read, but the outdated signal needs crates.io, and no committed Cargo.lock resolves them to versions, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Cargo manifest, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its Cargo dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (24 contributor(s) across 1038 commit(s) sampled, automation and bot accounts excluded). One of them holds 92% of the history; the other 23 hold 0.3% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization 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 authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit 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 audit controls.
  • C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention 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 retention controls.
  • C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights 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 data-subject rights controls.
  • ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • P1 CI/CD gates — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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.
  • P5 DR & Backup — 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. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
  • X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript source only, and no C# was loaded and no JavaScript/TypeScript was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • 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.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • 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.

The LLM boundary

LLM-set scores this run (4): D19, D21, D22, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

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

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

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

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

28 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was PartialFillExchange::ack_new at 51. A further 1 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being BybitError::to_value at 17 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: connector/src/bybit/mod.rs (BybitError::to_value at 17). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

L3FIFOQueueModel::modify_backtest_order (cyclomatic 17) · ×3hftbacktest/src/backtest/models/queue.rs:775
PartialFillExchange::ack_new (cyclomatic 51) · ×2hftbacktest/src/backtest/proc/partialfillexchange.rs:387
NoPartialFillExchange::process (cyclomatic 26) · ×2hftbacktest/src/backtest/proc/nopartialfillexchange.rs:529
ROIVectorMarketDepth::modify_order (cyclomatic 26) · ×2hftbacktest/src/depth/roivectormarketdepth.rs:634
UserDataStream::connect (cyclomatic 21) · ×2connector/src/binancespot/user_data_stream.rs:114

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

What to do

  1. Resolve the 3 L3FIFOQueueModel finding(s) in Cyclomatic Complexity — start with queue.rs (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 2 PartialFillExchange finding(s) in Cyclomatic Complexity — start with partialfillexchange.rs (2). — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 NoPartialFillExchange finding(s) in Cyclomatic Complexity — start with nopartialfillexchange.rs (2). — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

71 method(s) exceeded the cognitive complexity threshold of 15; the worst was PartialFillExchange::ack_new at 194.

collector::hyperliquid::handle (cognitive 24) · ×7collector/src/hyperliquid/mod.rs:11
HashMapMarketDepth::modify_order (cognitive 46) · ×5hftbacktest/src/depth/hashmapmarketdepth.rs:488
L3FIFOQueueModel::modify_backtest_order (cognitive 41) · ×5hftbacktest/src/backtest/models/queue.rs:775
FusedHashMapMarketDepth::update_bid_depth (cognitive 39) · ×5hftbacktest/src/depth/fuse.rs:75
PartialFillExchange::ack_new (cognitive 194) · ×4hftbacktest/src/backtest/proc/partialfillexchange.rs:387

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

What to do

  1. Resolve the 7 collector finding(s) in Cognitive Complexity — start with http.rs (5), mod.rs (2). — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 5 HashMapMarketDepth finding(s) in Cognitive Complexity — start with hashmapmarketdepth.rs (5). — One of this dimension's main actionable groups (5 warning-level).
  3. Resolve the 5 L3FIFOQueueModel finding(s) in Cognitive Complexity — start with queue.rs (5). — One of this dimension's main actionable groups (5 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

18 god class(es) detected.

FileTooLong: hftbacktest/binding.py · ×7py-hftbacktest/hftbacktest/binding.py
ClassTooLong: ROIVectorMarketDepth · ×4hftbacktest/src/depth/roivectormarketdepth.rs:15
TooManyFields: ExecutionReport · ×3connector/src/binancespot/msg/stream.rs:243
MethodTooLong: PartialFillExchange.ack_new · ×2hftbacktest/src/backtest/proc/partialfillexchange.rs:387
TooManyFunctions: py_hftbacktest::livepy-hftbacktest/src/live.rs:15

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

What to do

  1. Resolve the 7 FileTooLong finding(s) in God Classes — start with binding.py, mod.rs, queue.rs. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 4 ClassTooLong finding(s) in God Classes — start with roivectormarketdepth.rs, partialfillexchange.rs, queue.rs. — One of this dimension's main actionable groups (4 warning-level).
  3. Resolve the 3 TooManyFields finding(s) in God Classes — start with msg.rs (2), stream.rs. — One of this dimension's main actionable groups (3 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication7.0 / 10Adequate✓ Tool-verified

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

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

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

193 duplicated block group(s) detected. A further 12 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 205 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (11 lines × 2) · ×14connector/src/binancefutures/market_data_stream.rs:309
Duplicated block (8 lines × 2) · ×10collector/src/bybit/mod.rs:38
Duplicated block (15 lines × 2) · ×9connector/src/binancefutures/market_data_stream.rs:219
Duplicated block (13 lines × 2) · ×9connector/src/binancefutures/market_data_stream.rs:113
Duplicated block (5 lines × 2) · ×9connector/src/binancefutures/mod.rs:65

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

What to do

  1. Resolve the 14 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with market_data_stream.rs (3), queue.rs (3), public_stream.rs. — One of this dimension's main actionable groups (14 warning-level).
  2. Resolve the 10 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mod.rs (3), nopartialfillexchange.rs (2), hashmapmarketdepth.rs (2). — One of this dimension's main actionable groups (10 warning-level).
  3. Resolve the 9 Duplicated block (15 lines × 2) finding(s) in Code Duplication — start with rest.rs (4), mod.rs (3), market_data_stream.rs. — One of this dimension's main actionable groups (9 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

6 production modules (Cargo+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 4 of the 6 (the rest declare no modelled class or interface, export only macros, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)9.6 / 10Stronggated by 2 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

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

2 of 61 classes have LCOM4 above 3.

Low cohesion: RiskAdverseQueueModel (LCOM4 4) · ×2hftbacktest/src/backtest/models/queue.rs:44

What to do

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

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

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

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

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

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

29 test methods: 29 unit, 0 integration, 0 BDD, 0 e2e. The Rust suite contributes 27 `#[test]` function(s) across 8 file(s) declaring at least one; its unit/integration split is Cargo's own — 0 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 2 test function(s) across 1 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

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

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

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

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

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 44 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 5 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (39 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. 6 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares a Cargo manifest, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

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

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

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

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

Top hotspots: collector/src/hyperliquid/http.rs (2×17=34)

Hotspot: collector/src/hyperliquid/http.rscollector/src/hyperliquid/http.rs:20

What to do

  1. Resolve the 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with http.rs. — One of this dimension's main actionable groups (1 warning-level).

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

D17 · Explicit Debt9.7 / 10Stronggated by 49 serious findings✓ Tool-verified

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

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

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

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

TodoComment · ×42collector/src/binance/mod.rs:86
FixmeComment · ×7connector/src/binancefutures/market_data_stream.rs:99

What to do

  1. Resolve the 42 TodoComment finding(s) in Explicit Debt — start with user_data_stream.rs (5), private_stream.rs (4), ordermanager.rs (4). — One of this dimension's main actionable groups (42 warning-level).
  2. Resolve the 7 FixmeComment finding(s) in Explicit Debt — start with market_data_stream.rs (4), bot.rs (2), ordermanager.rs. — One of this dimension's main actionable groups (7 warning-level).
  3. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation QualityStrong◐ Sampled · advisory

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

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

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

This project's documentation is comprehensive and well-structured: the root README (HftBacktest) gives a clear overview, key features, and links to tutorials; the connector/README.md documents connectors with installation, architecture, and an example; each directory's README states what it provides and shows usage. The architecture/design docs (23 markdown files) cover design decisions, models, and latency, while data.rst dives into raw and normalized data formats and a live-discrepancy debugging guide. All visible content is present in the outline. The documentation is comprehensive and well-structured for a backtesting framework: the READMEs cover market-maker programs (Binance, Bybit, OKX), migration2, order-fill exchange models, a reference module listing all classes with member ordering, constants, data utilities, and data-validation. The architecture/Docs markdown files provide detailed design docs (e.g., NoPartialFillExchange conditions). There is no missing overview, installation, or usage; the only unshown content is clipped by the scanner, so those sections are not flagged as defects.

Documentation: no installation or build instructions · ×4connector/README.md

What to do

  1. Resolve the 4 Documentation finding(s) in Documentation Quality — start with README.md (2), debugging_backtesting_and_live_discrepancies.rst, data_validation.rst. — One of this dimension's main actionable groups (4 recommendation-level).

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

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

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

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

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

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D22 · Internal API ConsistencyStrong◐ Sampled · advisory

What it measures: Whether the internal API surface is consistent and coherent.

Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.

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

4 API inconsistencies across 101 exposed types.

Redundant operations for setting cache entries. `insert` and `set` appear to perform the same function (storing data under a key), creating confusion about which to use or if they have different side effects (e.g., overwrite vs. ignore existing).
Inconsistent order submission API. `submit_buy_order` and `submit_sell_order` are convenience methods that duplicate the functionality of `submit_order` when an `OrderRequest` with a `Side` is provided. This forces users to choose between a verbose specific method or a generic one, and creates API surface bloat.
Conflicting accessors for the same property. `descr` is exposed as both a property returning a typed `DType` and a method returning a `String`. This is inconsistent with Rust conventions (properties are fields/getters, methods are actions) and creates ambiguity on how to access the description.
Ambiguous naming for time progression. `elapse` and `elapse_bt` (likely 'backtest') suggest similar functionality (advancing time), but the distinction is unclear from the names alone. It is not immediately obvious if `elapse_bt` is a specialized version or if one is deprecated.

What to do

  1. Resolve the 1 Redundant operations for setting cache entries. `insert` and `set`… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Inconsistent order submission API. `submit_buy_order` and… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Conflicting accessors for the same property. `descr` is exposed as both… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).

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

D26 · Project Cohesion10.0 / 10Exemplary✓ Tool-verified

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

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

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

0 of 5 build units (Cargo) flagged as possibly oversized/incoherent.

✓ On the Gold path — maintain.

Detailed fixes: d26_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)7.4 / 10Adequategated by 27 critical findings✓ Tool-verified

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

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

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

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

31 finding(s): 0 critical, 27 high, 2 medium, 2 low. 26 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.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

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

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

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

No known-vulnerable dependencies in any ecosystem this repository declares.

✓ On the Gold path — maintain.

Detailed fixes: d30_recommendation.md.

D34 · Knowledge Freshness7.9 / 10Strong✓ Tool-verified

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

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

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

19 of 83 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is connector/src/bybit/msg.rs. Counted over 83 of the 108 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge

What to do

  1. Resolve the 1 Orphaned files with no living knowledge finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling8.7 / 10Adequategated by 5 critical findings✓ Tool-verified

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

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

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

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

Strongest change-coupling: btreemarketdepth.rs↔hashmapmarketdepth.rs 83%; nopartialfillexchange.rs↔partialfillexchange.rs 79%; rest.rs↔bot.rs 69%

Boundary-crossing change coupling: rest.rs ↔ bot.rs · ×5connector/src/binancefutures/rest.rs
Change coupling: btreemarketdepth.rs ↔ hashmapmarketdepth.rs · ×5hftbacktest/src/depth/btreemarketdepth.rs

What to do

  1. Resolve the 5 Boundary-crossing change coupling finding(s) in Change Coupling — start with mod.rs (2), rest.rs, ordermanager.rs. — One of this dimension's main actionable groups (5 issue-level).
  2. Resolve the 5 Change coupling finding(s) in Change Coupling — start with btreemarketdepth.rs, nopartialfillexchange.rs, binancefutures.py. — One of this dimension's main actionable groups (5 warning-level).

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

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition8.5 / 10Strong✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

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

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

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

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

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)7.2 / 10Strong✓ Tool-verified

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

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

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Add a 'Testing' section to the root README — how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 2 of 5 project(s) that lack one — worth up to 0.8 pts.
M2 · Architecture documentation3.0 / 10Weak✓ Tool-verified

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

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

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

What to do

  • Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

M4 · Documentation accuracy10.0 / 10Exemplary◐ Sampled · advisory

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

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

P1 · CI/CD gates8.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.

What to do

  • Run the test suite in CI via an explicit runner step for your stack, and gate merges on it.
P10 · Library API & versioning6.0 / 10Adequate✓ Tool-verified

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

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language 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.

  • 107/122 types (88%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.

What to do

  • Keep implementation types off the public surface (Rust: `pub(crate)`, or keep the module private) so internals can change without breaking consumers.
P2 · Observability7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

P3 · Security & performance tooling4.0 / 10Weak✓ Tool-verified

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

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

What to do

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

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

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

  • No release automation was found in CI — neither a deploy stage (Helm/Kubernetes/compose manifests, an orchestrated rollout) nor a publish job that ships the built artifact. Releases appear to be run by hand, which is slower, less repeatable and harder to reverse.

What to do

  • Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

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

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

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

Reference — by lens

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

LensScoreRatingImpact
Code Health75%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%ExemplarySolid.
Maturity68%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness49%Weak — gated by P4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security79%Adequate — gated by D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event Sourcing100%ExemplaryStrongest area.
Performance100%ExemplarySolid.
Not evidenced — 4 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: these audit 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 audit 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.
  • C4 Data Retention — Not assessed: these retention 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 retention 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.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights 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 data-subject rights 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.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 75 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written.
  • 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 — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
  • 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 — Not assessed: these authorization 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 authorization 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.
  • D10 Test Quality — ~1452 lines of test source are present (.py, .rs) 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.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D12 Dependency Hygiene — Not scored — 34 direct Cargo declaration(s) were read, but the outdated signal needs crates.io, and no committed Cargo.lock resolves them to versions, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • 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. 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 — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — symbol resolution incomplete — navigability not assessed
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 5 value object(s); 1 domain event(s); its domain events are published by services or handlers — no domain entity raises one
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. 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, Rust 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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb. Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • 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.
  • X1 Async 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
  • X10 Duplicated predicate — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X2 Cancellation propagation — 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
  • X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • 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
  • X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — 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
  • 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.
  • X7 Silent fallback defaults — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 32 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 1 more in this group — see findings.md.
D35 · Change Coupling · Boundary-crossing change coupling · ×5
  • Boundary-crossing change coupling: rest.rs ↔ bot.rs connector/src/binancefutures/rest.rs — `connector/src/binancefutures/rest.rs` (context connector) and `hftbacktest/src/live/bot.rs` (context hftbacktest) sit in DIFFERENT parts of the tree yet change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `68d580d6` refactor: prepare to merge with the master branch.; `374236e8` refactor: formatting (at that commit the files were still `rust/src/connector/binancefutures/rest.rs` and `rust/src/live/bot.rs`); `b09d705b` dev: the quantity at the front of the queue is introduced as a defaul… (at that commit the files were still `rust/src/connector/binancefutures/rest.rs` and `rust/src/live/bot.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: mod.rs ↔ bot.rs connector/src/binancefutures/mod.rs — `connector/src/binancefutures/mod.rs` (context connector) and `hftbacktest/src/live/bot.rs` (context hftbacktest) sit in DIFFERENT parts of the tree yet change together 50% of the time (14 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `6ff831a7` refactor(rust): rename ipc structs.; `fdcaf2c7` fix(rust): fix the order and position initial snapshot as a batch fee…; `68d580d6` refactor: prepare to merge with the master branch. — run `git show` on any of them.
  • Boundary-crossing change coupling: ordermanager.rs ↔ bot.rs connector/src/binancefutures/ordermanager.rs — `connector/src/binancefutures/ordermanager.rs` (context connector) and `hftbacktest/src/live/bot.rs` (context hftbacktest) sit in DIFFERENT parts of the tree yet change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `fdcaf2c7` fix(rust): fix the order and position initial snapshot as a batch fee…; `68d580d6` refactor: prepare to merge with the master branch.; `374236e8` refactor: formatting (at that commit the files were still `rust/src/connector/binancefutures/ordermanager.rs` and `rust/src/live/bot.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: connector.rs ↔ bot.rs connector/src/connector.rs — `connector/src/connector.rs` (context connector) and `hftbacktest/src/live/bot.rs` (context hftbacktest) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `6ff831a7` refactor(rust): rename ipc structs.; `a6671ed7` refactor: bybit connector. (WIP) (at that commit the files were still `rust/src/connector/mod.rs` and `rust/src/live/bot.rs`); `1ea67d5c` feat: add `Recorder` and working on batch order. (at that commit the files were still `rust/src/connector/mod.rs` and `rust/src/live/bot.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: mod.rs ↔ bot.rs connector/src/bybit/mod.rs — `connector/src/bybit/mod.rs` (context connector) and `hftbacktest/src/live/bot.rs` (context hftbacktest) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `6ff831a7` refactor(rust): rename ipc structs.; `fdcaf2c7` fix(rust): fix the order and position initial snapshot as a batch fee…; `68d580d6` refactor: prepare to merge with the master branch. — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 387 finding(s)
D17 · Explicit Debt · TodoComment · ×42
  • TodoComment collector/src/binance/mod.rs:86 — // todo: check the Spot API rate limits. — 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 connector/src/binancefutures/user_data_stream.rs:163 — // todo: reset the connection. — 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 connector/src/binancefutures/user_data_stream.rs:243 — // todo: rate-limit throttling. — 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 connector/src/binancefutures/user_data_stream.rs:262 — // todo: rate-limit throttling. — 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 connector/src/binancespot/user_data_stream.rs:257 — // todo: rate-limit throttling. — 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 connector/src/binancespot/user_data_stream.rs:276 — // todo: rate-limit throttling. — 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 connector/src/bybit/private_stream.rs:369 — // todo: rate-limit throttling. — 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 connector/src/bybit/private_stream.rs:400 — // todo: rate-limit throttling. — 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 connector/src/binancefutures/ordermanager.rs:303 — // todo: something went wrong? — 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 connector/src/binancespot/ordermanager.rs:288 — // todo: something went wrong? — 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 connector/src/binancefutures/ordermanager.rs:321 — // todo: check if the exchange timestamp exists in the REST response. — 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 connector/src/binancespot/ordermanager.rs:306 — // todo: check if the exchange timestamp exists in the REST response. — 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 connector/src/binancefutures/market_data_stream.rs:260 — // todo!() — 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 connector/src/binancespot/market_data_stream.rs:260 — // todo!() — 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 connector/src/bybit/private_stream.rs:87 — // todo: there is no orderLinkId, it requires a separate orderId — 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 connector/src/bybit/private_stream.rs:153 — // todo — 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 connector/src/bybit/mod.rs:206 — // // todo: fix the operation order. — 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 hftbacktest-derive/src/lib.rs:225 — // todo: L3PartialFillExchange is unsupported. This is verified within — 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 hftbacktest/examples/custom_evhandling.rs:135 — // todo: implement logic for handling market feed events. — 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 hftbacktest/examples/custom_evhandling.rs:147 — // todo: Implement logic for handling order response events. — 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 hftbacktest/src/types.rs:85 — // todo!: improve this to deliver detailed error information. — 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 hftbacktest/src/types.rs:741 — // todo: currently, they are cumulative values, but they need to be values within the record — 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 hftbacktest/src/backtest/models/queue.rs:802 — // todo: Status::Replaced or Status::New? — 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 hftbacktest/src/backtest/models/queue.rs:819 — // todo: Status::Replaced or Status::New? — 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 hftbacktest/src/backtest/models/queue.rs:843 — // todo: Status::Replaced or Status::New? — 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.
  • + 17 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×14
  • Duplicated block (11 lines × 2) connector/src/binancefutures/market_data_stream.rs:309 — connector/src/binancefutures/market_data_stream.rs:309-319 | connector/src/binancespot/market_data_stream.rs:309-319 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 2) connector/src/binancefutures/market_data_stream.rs:316 — connector/src/binancefutures/market_data_stream.rs:316-326 | connector/src/binancefutures/user_data_stream.rs:213-223 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) connector/src/binancespot/market_data_stream.rs:316 — connector/src/binancespot/market_data_stream.rs:316-326 | connector/src/binancespot/user_data_stream.rs:227-237 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) connector/src/bybit/public_stream.rs:85 — connector/src/bybit/public_stream.rs:85-95 | connector/src/bybit/public_stream.rs:124-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) hftbacktest/src/backtest/mod.rs:741 — hftbacktest/src/backtest/mod.rs:741-751 | hftbacktest/src/backtest/mod.rs:1107-1117 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/models/queue.rs:517 — hftbacktest/src/backtest/models/queue.rs:517-527 | hftbacktest/src/backtest/models/queue.rs:564-574 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/models/queue.rs:706 — hftbacktest/src/backtest/models/queue.rs:706-716 | hftbacktest/src/backtest/models/queue.rs:719-729 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/models/queue.rs:747 — hftbacktest/src/backtest/models/queue.rs:747-757 | hftbacktest/src/backtest/models/queue.rs:760-770 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:127 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:127-137 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:152-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:51 — hftbacktest/src/depth/btreemarketdepth.rs:51-61 | hftbacktest/src/depth/hashmapmarketdepth.rs:72-82 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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) py-hftbacktest/src/live.rs:168 — py-hftbacktest/src/live.rs:168-178 | py-hftbacktest/src/live.rs:411-421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) connector/src/binancefutures/rest.rs:39 — connector/src/binancefutures/rest.rs:39-49 | connector/src/binancespot/rest.rs:43-53 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:64 — hftbacktest/src/backtest/proc/l3_local.rs:64-74 | hftbacktest/src/backtest/proc/local.rs:64-74 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 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) py-hftbacktest/hftbacktest/data/utils/tardis.py:286 — py-hftbacktest/hftbacktest/data/utils/tardis.py:286-296 | py-hftbacktest/hftbacktest/data/utils/tardis.py:301-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×10
  • Duplicated block (8 lines × 2) collector/src/bybit/mod.rs:38 — collector/src/bybit/mod.rs:38-45 | collector/src/hyperliquid/mod.rs:73-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) connector/src/bybit/public_stream.rs:58 — connector/src/bybit/public_stream.rs:58-65 | connector/src/bybit/public_stream.rs:97-104 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/mod.rs:777 — hftbacktest/src/backtest/mod.rs:777-784 | hftbacktest/src/backtest/mod.rs:822-829 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:251 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:251-258 | hftbacktest/src/backtest/proc/partialfillexchange.rs:300-307 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:287 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:287-294 | hftbacktest/src/backtest/proc/partialfillexchange.rs:348-355 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:226 — hftbacktest/src/depth/btreemarketdepth.rs:226-233 | hftbacktest/src/depth/hashmapmarketdepth.rs:319-326 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (8 lines × 2) hftbacktest/src/depth/hashmapmarketdepth.rs:406 — hftbacktest/src/depth/hashmapmarketdepth.rs:406-413 | hftbacktest/src/depth/hashmapmarketdepth.rs:522-529 — both copies are in the same file, so extract the block into 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) hftbacktest/src/depth/hashmapmarketdepth.rs:433 — hftbacktest/src/depth/hashmapmarketdepth.rs:433-440 | hftbacktest/src/depth/hashmapmarketdepth.rs:560-567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) connector/src/binancefutures/rest.rs:26 — connector/src/binancefutures/rest.rs:26-33 | connector/src/bybit/rest.rs:21-28 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) connector/src/binancefutures/msg/mod.rs:16 — connector/src/binancefutures/msg/mod.rs:16-23 | connector/src/binancespot/msg/mod.rs:16-23 — before extracting anything, compare `connector/src/binancefutures/msg/mod.rs` and `connector/src/binancespot/msg/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×9
  • Duplicated block (15 lines × 2) connector/src/binancefutures/market_data_stream.rs:219 — connector/src/binancefutures/market_data_stream.rs:219-233 | connector/src/binancespot/market_data_stream.rs:219-233 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/mod.rs:237 — connector/src/binancefutures/mod.rs:237-251 | connector/src/binancespot/mod.rs:240-254 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/rest.rs:86 — connector/src/binancefutures/rest.rs:86-100 | connector/src/binancespot/rest.rs:89-103 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/rest.rs:110 — connector/src/binancefutures/rest.rs:110-124 | connector/src/binancespot/rest.rs:113-127 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/rest.rs:134 — connector/src/binancefutures/rest.rs:134-148 | connector/src/binancespot/rest.rs:137-151 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/rest.rs:172 — connector/src/binancefutures/rest.rs:172-186 | connector/src/binancespot/rest.rs:204-218 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) connector/src/binancefutures/msg/mod.rs:29 — connector/src/binancefutures/msg/mod.rs:29-43 | connector/src/binancespot/msg/mod.rs:29-43 — before extracting anything, compare `connector/src/binancefutures/msg/mod.rs` and `connector/src/binancespot/msg/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) hftbacktest/src/depth/fuse.rs:370 — hftbacktest/src/depth/fuse.rs:370-384 | hftbacktest/src/depth/fuse.rs:478-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) connector/src/bybit/mod.rs:313 — connector/src/bybit/mod.rs:313-327 | connector/src/bybit/mod.rs:338-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×9
  • Duplicated block (13 lines × 2) connector/src/binancefutures/market_data_stream.rs:113 — connector/src/binancefutures/market_data_stream.rs:113-125 | connector/src/binancefutures/market_data_stream.rs:196-208 — both copies are in the same file, so extract the block into 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) connector/src/binancefutures/market_data_stream.rs:267 — connector/src/binancefutures/market_data_stream.rs:267-279 | connector/src/binancespot/market_data_stream.rs:267-279 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 2) connector/src/binancefutures/mod.rs:311 — connector/src/binancefutures/mod.rs:311-323 | connector/src/binancespot/mod.rs:314-326 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 2) connector/src/bybit/ordermanager.rs:65 — connector/src/bybit/ordermanager.rs:65-77 | connector/src/bybit/ordermanager.rs:81-93 — both copies are in the same file, so extract the block into 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) connector/src/binancefutures/msg/mod.rs:66 — connector/src/binancefutures/msg/mod.rs:66-78 | connector/src/binancespot/msg/mod.rs:66-78 — before extracting anything, compare `connector/src/binancefutures/msg/mod.rs` and `connector/src/binancespot/msg/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) hftbacktest/src/backtest/models/queue.rs:822 — hftbacktest/src/backtest/models/queue.rs:822-834 | hftbacktest/src/backtest/models/queue.rs:921-933 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:595 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:595-607 | hftbacktest/src/backtest/proc/partialfillexchange.rs:813-825 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:364 — hftbacktest/src/depth/btreemarketdepth.rs:364-376 | hftbacktest/src/depth/hashmapmarketdepth.rs:530-542 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (13 lines × 2) connector/src/binancefutures/msg/mod.rs:48 — connector/src/binancefutures/msg/mod.rs:48-60 | connector/src/binancespot/msg/mod.rs:48-60 — before extracting anything, compare `connector/src/binancefutures/msg/mod.rs` and `connector/src/binancespot/msg/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×9
  • Duplicated block (5 lines × 2) connector/src/binancefutures/mod.rs:65 — connector/src/binancefutures/mod.rs:65-69 | connector/src/binancespot/mod.rs:66-70 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) connector/src/binancefutures/mod.rs:71 — connector/src/binancefutures/mod.rs:71-75 | connector/src/binancespot/mod.rs:72-76 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) connector/src/bybit/mod.rs:75 — connector/src/bybit/mod.rs:75-79 | connector/src/bybit/mod.rs:81-85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) hftbacktest/src/backtest/models/queue.rs:502 — hftbacktest/src/backtest/models/queue.rs:502-506 | hftbacktest/src/backtest/models/queue.rs:549-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:262 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:262-266 | hftbacktest/src/backtest/proc/partialfillexchange.rs:317-321 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:298 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:298-302 | hftbacktest/src/backtest/proc/partialfillexchange.rs:365-369 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) hftbacktest/src/depth/fuse.rs:601 — hftbacktest/src/depth/fuse.rs:601-605 | hftbacktest/src/depth/hashmapmarketdepth.rs:346-350 — before extracting anything, compare `hftbacktest/src/depth/fuse.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) hftbacktest/src/depth/fuse.rs:621 — hftbacktest/src/depth/fuse.rs:621-625 | hftbacktest/src/depth/hashmapmarketdepth.rs:367-371 — before extracting anything, compare `hftbacktest/src/depth/fuse.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) connector/src/binancefutures/user_data_stream.rs:122 — connector/src/binancefutures/user_data_stream.rs:122-126 | connector/src/binancespot/user_data_stream.rs:120-124 — `connector/src/binancefutures/user_data_stream.rs` and `connector/src/binancespot/user_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 79 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×8
  • Duplicated block (12 lines × 2) connector/src/binancefutures/mod.rs:133 — connector/src/binancefutures/mod.rs:133-144 | connector/src/binancespot/mod.rs:136-147 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12 lines × 2) connector/src/binancefutures/user_data_stream.rs:244 — connector/src/binancefutures/user_data_stream.rs:244-255 | connector/src/binancespot/user_data_stream.rs:258-269 — `connector/src/binancefutures/user_data_stream.rs` and `connector/src/binancespot/user_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 79 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12 lines × 2) connector/src/bybit/private_stream.rs:184 — connector/src/bybit/private_stream.rs:184-195 | connector/src/bybit/private_stream.rs:206-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.
  • Duplicated block (12 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:265 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:265-276 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:301-312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) py-hftbacktest/src/live.rs:75 — py-hftbacktest/src/live.rs:75-86 | py-hftbacktest/src/live.rs:318-329 — both copies are in the same file, so extract the block into 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) py-hftbacktest/src/live.rs:144 — py-hftbacktest/src/live.rs:144-155 | py-hftbacktest/src/live.rs:387-398 — both copies are in the same file, so extract the block into 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) connector/src/binancefutures/market_data_stream.rs:52 — connector/src/binancefutures/market_data_stream.rs:52-63 | connector/src/binancespot/market_data_stream.rs:52-63 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:101 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:101-112 | hftbacktest/src/backtest/proc/partialfillexchange.rs:115-126 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×8
  • Duplicated block (9 lines × 2) connector/src/binancefutures/user_data_stream.rs:208 — connector/src/binancefutures/user_data_stream.rs:208-216 | connector/src/binancespot/user_data_stream.rs:222-230 — `connector/src/binancefutures/user_data_stream.rs` and `connector/src/binancespot/user_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 79 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) hftbacktest/src/backtest/data/reader.rs:405 — hftbacktest/src/backtest/data/reader.rs:405-413 | hftbacktest/src/backtest/data/reader.rs:429-437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:339 — hftbacktest/src/depth/btreemarketdepth.rs:339-347 | hftbacktest/src/depth/hashmapmarketdepth.rs:496-504 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 × 2) hftbacktest/src/depth/btreemarketdepth.rs:393 — hftbacktest/src/depth/btreemarketdepth.rs:393-401 | hftbacktest/src/depth/hashmapmarketdepth.rs:568-576 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 × 2) hftbacktest/src/depth/fuse.rs:566 — hftbacktest/src/depth/fuse.rs:566-574 | hftbacktest/src/depth/hashmapmarketdepth.rs:315-323 — before extracting anything, compare `hftbacktest/src/depth/fuse.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) hftbacktest/src/live/ipc/iceoryx.rs:84 — hftbacktest/src/live/ipc/iceoryx.rs:84-92 | hftbacktest/src/live/ipc/iceoryx.rs:136-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) hftbacktest/src/live/ipc/iceoryx.rs:95 — hftbacktest/src/live/ipc/iceoryx.rs:95-103 | hftbacktest/src/live/ipc/iceoryx.rs:125-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:70 — py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:70-78 | py-hftbacktest/hftbacktest/data/utils/mexc.py:56-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:68` calls `DiffOrderBookSnapshot` and `py-hftbacktest/hftbacktest/data/utils/mexc.py:54` 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.
D17 · Explicit Debt · FixmeComment · ×7
  • FixmeComment connector/src/binancefutures/market_data_stream.rs:99 — // fixme: currently supports natural refresh only. — 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.
  • FixmeComment connector/src/binancespot/market_data_stream.rs:99 — // fixme: currently supports natural refresh only. — 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.
  • FixmeComment connector/src/binancefutures/market_data_stream.rs:234 — // fixme: waits for pending messages without blocking. — 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.
  • FixmeComment connector/src/binancespot/market_data_stream.rs:234 — // fixme: waits for pending messages without blocking. — 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.
  • FixmeComment connector/src/bybit/ordermanager.rs:80 — // fixme: there is no valid order_link_id. — 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.
  • FixmeComment hftbacktest/src/live/bot.rs:406 — // fixme: timeout should be specified by the argument. — 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.
  • FixmeComment hftbacktest/src/live/bot.rs:590 — // fixme: timeout should be specified by the argument. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · collector · ×7
  • collector::hyperliquid::handle (cognitive 24) collector/src/hyperliquid/mod.rs:11 — collector::hyperliquid::handle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • collector::hyperliquid::http::connect (cognitive 20) collector/src/hyperliquid/http.rs:20 — collector::hyperliquid::http::connect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (4 pts), loops 3, 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.
  • collector::binancefuturesum::http::connect (cognitive 20) collector/src/binancefuturesum/http.rs:58 — collector::binancefuturesum::http::connect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (5 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • collector::binance::http::connect (cognitive 20) collector/src/binance/http.rs:57 — collector::binance::http::connect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (5 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • collector::binancefuturescm::http::connect (cognitive 20) collector/src/binancefuturescm/http.rs:58 — collector::binancefuturescm::http::connect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (5 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • collector::bybit::http::connect (cognitive 19) collector/src/bybit/http.rs:20 — collector::bybit::http::connect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), match/switch 3 (7 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • collector::binance::handle (cognitive 17) collector/src/binance/mod.rs:13 — collector::binance::handle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 1 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D3 · God Classes · FileTooLong · ×7
  • FileTooLong: hftbacktest/binding.py py-hftbacktest/hftbacktest/binding.py — FileTooLong — 985 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 485 over it, 1.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backtest/mod.rs hftbacktest/src/backtest/mod.rs — FileTooLong — 759 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 259 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: models/queue.rs hftbacktest/src/backtest/models/queue.rs — FileTooLong — 686 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: L3FIFOQueueModel (3 blocks, 481-1128). The bar is 500 significant lines; this is 186 over it, 1.37× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: proc/partialfillexchange.rs hftbacktest/src/backtest/proc/partialfillexchange.rs — FileTooLong — 577 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: PartialFillExchange (3 blocks, 78-867). The bar is 500 significant lines; this is 77 over it, 1.15× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: depth/roivectormarketdepth.rs hftbacktest/src/depth/roivectormarketdepth.rs — FileTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 96% of them inside a single declaration: ROIVectorMarketDepth (6 blocks, 15-803). The bar is 500 significant lines; this is 76 over it, 1.15× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/types.rs hftbacktest/src/types.rs — FileTooLong — 519 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 19 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: bybit/msg.rs connector/src/bybit/msg.rs — FileTooLong — 509 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 9 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) connector/src/binancefutures/mod.rs:295 — connector/src/binancefutures/mod.rs:295-308 | connector/src/binancespot/mod.rs:298-311 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (14 lines × 2) connector/src/binancefutures/rest.rs:63 — connector/src/binancefutures/rest.rs:63-76 | connector/src/binancespot/rest.rs:66-79 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (14 lines × 2) connector/src/bybit/trade_stream.rs:177 — connector/src/bybit/trade_stream.rs:177-190 | connector/src/bybit/trade_stream.rs:207-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) connector/src/bybit/trade_stream.rs:192 — connector/src/bybit/trade_stream.rs:192-205 | connector/src/bybit/trade_stream.rs:222-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) connector/src/binancefutures/ordermanager.rs:145 — connector/src/binancefutures/ordermanager.rs:145-158 | connector/src/binancespot/ordermanager.rs:130-143 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (14 lines × 2) collector/src/bybit/http.rs:88 — collector/src/bybit/http.rs:88-101 | collector/src/hyperliquid/http.rs:78-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) hftbacktest/examples/4_latency.py:31 — hftbacktest/examples/4_latency.py:31-44 | py-hftbacktest/hftbacktest/data/utils/feed_order_latency.py:29-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×7
  • Duplicated block (10 lines × 2) collector/src/binancefuturescm/http.rs:35 — collector/src/binancefuturescm/http.rs:35-44 | collector/src/binancefuturesum/http.rs:35-44 — `collector/src/binancefuturescm/http.rs` and `collector/src/binancefuturesum/http.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 124 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) connector/src/binancefutures/market_data_stream.rs:188 — connector/src/binancefutures/market_data_stream.rs:188-197 | connector/src/binancespot/market_data_stream.rs:188-197 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) connector/src/binancefutures/mod.rs:213 — connector/src/binancefutures/mod.rs:213-222 | connector/src/binancespot/mod.rs:216-225 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) connector/src/bybit/public_stream.rs:68 — connector/src/bybit/public_stream.rs:68-77 | connector/src/bybit/public_stream.rs:107-116 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:341 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:341-350 | hftbacktest/src/backtest/proc/partialfillexchange.rs:473-482 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:300 — hftbacktest/src/depth/btreemarketdepth.rs:300-309 | hftbacktest/src/depth/hashmapmarketdepth.rs:449-458 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (10 lines × 2) connector/src/bybit/private_stream.rs:315 — connector/src/bybit/private_stream.rs:315-324 | connector/src/bybit/trade_stream.rs:122-131 — before extracting anything, compare `connector/src/bybit/private_stream.rs` and `connector/src/bybit/trade_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×6
  • Duplicated block (18 lines × 2) connector/src/binancefutures/mod.rs:350 — connector/src/binancefutures/mod.rs:350-367 | connector/src/binancespot/mod.rs:354-371 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 2) connector/src/binancefutures/ordermanager.rs:86 — connector/src/binancefutures/ordermanager.rs:86-103 | connector/src/binancespot/ordermanager.rs:71-88 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 2) hftbacktest/src/backtest/models/queue.rs:892 — hftbacktest/src/backtest/models/queue.rs:892-909 | hftbacktest/src/backtest/models/queue.rs:931-948 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:156 — hftbacktest/src/backtest/proc/l3_local.rs:156-173 | hftbacktest/src/backtest/proc/local.rs:217-234 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:199 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:199-216 | hftbacktest/src/backtest/proc/partialfillexchange.rs:248-265 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 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) hftbacktest/src/backtest/proc/partialfillexchange.rs:320 — hftbacktest/src/backtest/proc/partialfillexchange.rs:320-337 | hftbacktest/src/backtest/proc/partialfillexchange.rs:368-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×6
  • Duplicated block (6 lines × 2) connector/src/binancefutures/mod.rs:112 — connector/src/binancefutures/mod.rs:112-117 | connector/src/binancespot/mod.rs:115-120 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) connector/src/bybit/public_stream.rs:167 — connector/src/bybit/public_stream.rs:167-172 | connector/src/bybit/trade_stream.rs:62-67 — before extracting anything, compare `connector/src/bybit/public_stream.rs` and `connector/src/bybit/trade_stream.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) hftbacktest/src/depth/fuse.rs:597 — hftbacktest/src/depth/fuse.rs:597-602 | hftbacktest/src/depth/fuse.rs:617-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) hftbacktest/src/live/ipc/iceoryx.rs:77 — hftbacktest/src/live/ipc/iceoryx.rs:77-82 | hftbacktest/src/live/ipc/iceoryx.rs:118-123 — both copies are in the same file, so extract the block into 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) hftbacktest/src/types.rs:648 — hftbacktest/src/types.rs:648-653 | hftbacktest/src/types.rs:672-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) hftbacktest/src/backtest/data/reader.rs:390 — hftbacktest/src/backtest/data/reader.rs:390-396 | hftbacktest/src/backtest/data/reader.rs:415-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · HashMapMarketDepth · ×5
  • HashMapMarketDepth::modify_order (cognitive 46) hftbacktest/src/depth/hashmapmarketdepth.rs:488 — HashMapMarketDepth::modify_order has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (46 pts) (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • HashMapMarketDepth::clear_depth (cognitive 35) hftbacktest/src/depth/hashmapmarketdepth.rs:196 — HashMapMarketDepth::clear_depth has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (8 pts), match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • HashMapMarketDepth::delete_order (cognitive 20) hftbacktest/src/depth/hashmapmarketdepth.rs:444 — HashMapMarketDepth::delete_order has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (20 pts) (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.
  • HashMapMarketDepth::update_bid_depth (cognitive 18) hftbacktest/src/depth/hashmapmarketdepth.rs:86 — HashMapMarketDepth::update_bid_depth has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (HashMapMarketDepth::update_ask_depth) 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.
  • HashMapMarketDepth::update_ask_depth (cognitive 18) hftbacktest/src/depth/hashmapmarketdepth.rs:141 — HashMapMarketDepth::update_ask_depth has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (HashMapMarketDepth::update_bid_depth) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · L3FIFOQueueModel · ×5
  • L3FIFOQueueModel::modify_backtest_order (cognitive 41) hftbacktest/src/backtest/models/queue.rs:775 — L3FIFOQueueModel::modify_backtest_order has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::modify_market_feed_order) 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.
  • L3FIFOQueueModel::modify_market_feed_order (cognitive 41) hftbacktest/src/backtest/models/queue.rs:877 — L3FIFOQueueModel::modify_market_feed_order has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::modify_backtest_order) 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.
  • L3FIFOQueueModel::fill_market_feed_order (cognitive 29) hftbacktest/src/backtest/models/queue.rs:974 — L3FIFOQueueModel::fill_market_feed_order has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (8 pts), match/switch 3 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • L3FIFOQueueModel::fill_bid_between (cognitive 23) hftbacktest/src/backtest/models/queue.rs:497 — L3FIFOQueueModel::fill_bid_between has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::fill_ask_between) 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.
  • L3FIFOQueueModel::fill_ask_between (cognitive 23) hftbacktest/src/backtest/models/queue.rs:544 — L3FIFOQueueModel::fill_ask_between has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::fill_bid_between) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FusedHashMapMarketDepth · ×5
  • FusedHashMapMarketDepth::update_bid_depth (cognitive 39) hftbacktest/src/depth/fuse.rs:75 — FusedHashMapMarketDepth::update_bid_depth has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 20). 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. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_ask_depth) 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.
  • FusedHashMapMarketDepth::update_ask_depth (cognitive 39) hftbacktest/src/depth/fuse.rs:191 — FusedHashMapMarketDepth::update_ask_depth has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 20). 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. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_bid_depth) 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.
  • FusedHashMapMarketDepth::clear_depth (cognitive 25) hftbacktest/src/depth/fuse.rs:307 — FusedHashMapMarketDepth::clear_depth has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 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.
  • FusedHashMapMarketDepth::update_best_bid (cognitive 22) hftbacktest/src/depth/fuse.rs:347 — FusedHashMapMarketDepth::update_best_bid has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_best_ask) 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.
  • FusedHashMapMarketDepth::update_best_ask (cognitive 22) hftbacktest/src/depth/fuse.rs:455 — FusedHashMapMarketDepth::update_best_ask has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_best_bid) 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.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: btreemarketdepth.rs ↔ hashmapmarketdepth.rs hftbacktest/src/depth/btreemarketdepth.rs — `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` change together 83% of the time (10 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `1b33a781` fix: fix L3 backtesting.; `f6097e18` feat(rust): add functionality to retrieve the depth snapshot.; `e6ac0f8a` feat(rust): add unstable version of `FusedHashMapMarketDepth` to fuse… (at that commit the files were still `rust/src/depth/btreemarketdepth.rs` and `rust/src/depth/hashmapmarketdepth.rs`) — run `git show` on any of them.
  • Change coupling: nopartialfillexchange.rs ↔ partialfillexchange.rs hftbacktest/src/backtest/proc/nopartialfillexchange.rs — `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` change together 79% of the time (22 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `5f3ec40b` fix: update the order status to `Status::New` when the order is modif…; `363bf65d` fix: fix the issue where a modified order reverts back to the origina…; `33acf184` fix(rs): fix the problem where leaves_qty does not get updated in the… — run `git show` on any of them.
  • Change coupling: binancefutures.py ↔ tardis.py py-hftbacktest/hftbacktest/data/utils/binancefutures.py — `py-hftbacktest/hftbacktest/data/utils/binancefutures.py` and `py-hftbacktest/hftbacktest/data/utils/tardis.py` change together 61% of the time (11 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `38e15412` fix(py): fix data utils according to the hftbacktest2 changes.; `21ecd471` perf(py): reduce the memory usage in the data conversion utils. (at that commit the files were still `hftbacktest/data/utils/binancefutures.py` and `hftbacktest/data/utils/tardis.py`); `49b39242` fix: fix incorrect event flag handling in the data utils. (at that commit the files were still `hftbacktest/data/utils/binancefutures.py` and `hftbacktest/data/utils/tardis.py`) — run `git show` on any of them.
  • Change coupling: l3_local.rs ↔ l3_nopartialfillexchange.rs hftbacktest/src/backtest/proc/l3_local.rs — `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0ee237aa` Update L3 processors to use new Processor trait; `05e66e40` refactor(rust): refactor L3 implementation.; `1b33a781` fix: fix L3 backtesting. — run `git show` on any of them.
  • Change coupling: local.rs ↔ nopartialfillexchange.rs hftbacktest/src/backtest/proc/local.rs — `hftbacktest/src/backtest/proc/local.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` change together 52% of the time (14 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `dc9611b0` Processor::time_of -> time_seen; `a180ae5c` Consolidate event reading/processing code; `90bb7b68` fix: fix the rejection response. — run `git show` on any of them.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (4 members, 50+ identical tokens) collector/src/binance/http.rs:131 — collector/src/binance/http.rs:131-172 | collector/src/binancefuturescm/http.rs:132-173 | collector/src/binancefuturesum/http.rs:132-173 | collector/src/bybit/http.rs:107-148 — 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) connector/src/binancefutures/market_data_stream.rs:65 — connector/src/binancefutures/market_data_stream.rs:65-185 | connector/src/binancefutures/market_data_stream.rs:187-263 | connector/src/binancespot/market_data_stream.rs:65-185 | connector/src/binancespot/market_data_stream.rs:187-263 — 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) connector/src/binancefutures/ordermanager.rs:164 — connector/src/binancefutures/ordermanager.rs:164-197 | connector/src/binancefutures/ordermanager.rs:203-245 | connector/src/binancespot/ordermanager.rs:149-182 | connector/src/binancespot/ordermanager.rs:188-230 — 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:218 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:218-228 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:230-240 | hftbacktest/src/backtest/proc/partialfillexchange.rs:267-277 | hftbacktest/src/backtest/proc/partialfillexchange.rs:279-289 — 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) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:247 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:247-276 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:283-312 | hftbacktest/src/backtest/proc/partialfillexchange.rs:296-337 | hftbacktest/src/backtest/proc/partialfillexchange.rs:344-385 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×5
  • Duplicated block (17 lines × 2) connector/src/binancefutures/user_data_stream.rs:137 — connector/src/binancefutures/user_data_stream.rs:137-153 | connector/src/binancespot/user_data_stream.rs:152-168 — `connector/src/binancefutures/user_data_stream.rs` and `connector/src/binancespot/user_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 79 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (17 lines × 2) hftbacktest/src/backtest/models/queue.rs:912 — hftbacktest/src/backtest/models/queue.rs:912-928 | hftbacktest/src/backtest/models/queue.rs:951-967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) hftbacktest/src/backtest/proc/partialfillexchange.rs:420 — hftbacktest/src/backtest/proc/partialfillexchange.rs:420-436 | hftbacktest/src/backtest/proc/partialfillexchange.rs:548-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) hftbacktest/src/depth/hashmapmarketdepth.rs:97 — hftbacktest/src/depth/hashmapmarketdepth.rs:97-113 | hftbacktest/src/depth/hashmapmarketdepth.rs:152-168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) py-hftbacktest/hftbacktest/data/utils/bybit.py:223 — py-hftbacktest/hftbacktest/data/utils/bybit.py:223-239 | py-hftbacktest/hftbacktest/data/utils/bybit.py:452-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×5
  • Duplicated block (16 lines × 2) connector/src/binancefutures/market_data_stream.rs:136 — connector/src/binancefutures/market_data_stream.rs:136-151 | connector/src/binancespot/market_data_stream.rs:136-151 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) connector/src/binancefutures/market_data_stream.rs:170 — connector/src/binancefutures/market_data_stream.rs:170-185 | connector/src/binancespot/market_data_stream.rs:170-185 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) connector/src/bybit/private_stream.rs:258 — connector/src/bybit/private_stream.rs:258-273 | connector/src/bybit/trade_stream.rs:76-91 — before extracting anything, compare `connector/src/bybit/private_stream.rs` and `connector/src/bybit/trade_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:263 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:263-278 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:419-434 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) hftbacktest/src/backtest/proc/partialfillexchange.rs:457 — hftbacktest/src/backtest/proc/partialfillexchange.rs:457-472 | hftbacktest/src/backtest/proc/partialfillexchange.rs:585-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×5
  • Duplicated block (7 lines × 2) connector/src/binancefutures/mod.rs:148 — connector/src/binancefutures/mod.rs:148-154 | connector/src/binancespot/mod.rs:151-157 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:315 — hftbacktest/src/depth/btreemarketdepth.rs:315-321 | hftbacktest/src/depth/hashmapmarketdepth.rs:468-474 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (7 lines × 2) hftbacktest/src/types.rs:661 — hftbacktest/src/types.rs:661-667 | hftbacktest/src/types.rs:685-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) connector/src/binancefutures/mod.rs:228 — connector/src/binancefutures/mod.rs:228-234 | connector/src/binancespot/mod.rs:231-237 — `connector/src/binancefutures/mod.rs` and `connector/src/binancespot/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:175 — hftbacktest/src/backtest/proc/l3_local.rs:175-181 | hftbacktest/src/backtest/proc/local.rs:236-242 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 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.
D2 · Cognitive Complexity · PartialFillExchange · ×4
  • PartialFillExchange::ack_new (cognitive 194) hftbacktest/src/backtest/proc/partialfillexchange.rs:387 — PartialFillExchange::ack_new has cognitive complexity 194 (threshold 15). Drivers by points: if/else 29 (129 pts), loops 10 (48 pts), match/switch 6 (17 pts) (nesting depth added 149). 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.
  • PartialFillExchange::process (cognitive 59) hftbacktest/src/backtest/proc/partialfillexchange.rs:747 — PartialFillExchange::process has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 6 (22 pts), boolean chains 4 (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.
  • PartialFillExchange::on_best_bid_update (cognitive 18) hftbacktest/src/backtest/proc/partialfillexchange.rs:291 — PartialFillExchange::on_best_bid_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PartialFillExchange::on_best_ask_update) 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.
  • PartialFillExchange::on_best_ask_update (cognitive 18) hftbacktest/src/backtest/proc/partialfillexchange.rs:339 — PartialFillExchange::on_best_ask_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PartialFillExchange::on_best_bid_update) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · NoPartialFillExchange · ×4
  • NoPartialFillExchange::process (cognitive 59) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:529 — NoPartialFillExchange::process has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 6 (22 pts), boolean chains 4 (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.
  • NoPartialFillExchange::ack_new (cognitive 25) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:314 — NoPartialFillExchange::ack_new has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 7 (11 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • NoPartialFillExchange::on_best_bid_update (cognitive 18) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:242 — NoPartialFillExchange::on_best_bid_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NoPartialFillExchange::on_best_ask_update) 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.
  • NoPartialFillExchange::on_best_ask_update (cognitive 18) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:278 — NoPartialFillExchange::on_best_ask_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NoPartialFillExchange::on_best_bid_update) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MarketDataStream · ×4
  • MarketDataStream::process_message (cognitive 23) connector/src/binancefutures/market_data_stream.rs:65 — MarketDataStream::process_message has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (8 pts), loops 2 (6 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MarketDataStream::process_message (cognitive 23) connector/src/binancespot/market_data_stream.rs:65 — MarketDataStream::process_message has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (8 pts), loops 2 (6 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MarketDataStream::connect (cognitive 16) connector/src/binancefutures/market_data_stream.rs:265 — MarketDataStream::connect has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MarketDataStream::connect (cognitive 16) connector/src/binancespot/market_data_stream.rs:265 — MarketDataStream::connect has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D3 · God Classes · ClassTooLong · ×4
  • ClassTooLong: ROIVectorMarketDepth hftbacktest/src/depth/roivectormarketdepth.rs:15 — ClassTooLong — 554 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 6 methods, 6 blocks, lines 15-803. The bar is 400 significant lines; this is 154 over it, 1.39× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PartialFillExchange hftbacktest/src/backtest/proc/partialfillexchange.rs:78 — ClassTooLong — 545 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 3 blocks, lines 78-867. The bar is 400 significant lines; this is 145 over it, 1.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: L3FIFOQueueModel hftbacktest/src/backtest/models/queue.rs:481 — ClassTooLong — 444 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 3 blocks, lines 481-1128. The bar is 400 significant lines; this is 44 over it, 1.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: HashMapMarketDepth hftbacktest/src/depth/hashmapmarketdepth.rs:21 — ClassTooLong — 428 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 6 blocks, lines 21-617. The bar is 400 significant lines; this is 28 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×4
  • Duplicated block (26 lines × 2) connector/src/binancefutures/ordermanager.rs:283 — connector/src/binancefutures/ordermanager.rs:283-308 | connector/src/binancespot/ordermanager.rs:268-293 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (26 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:569 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:569-594 | hftbacktest/src/backtest/proc/partialfillexchange.rs:787-812 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 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 (26 lines × 2) hftbacktest/src/depth/fuse.rs:146 — hftbacktest/src/depth/fuse.rs:146-171 | hftbacktest/src/depth/fuse.rs:391-416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) hftbacktest/src/depth/fuse.rs:262 — hftbacktest/src/depth/fuse.rs:262-287 | hftbacktest/src/depth/fuse.rs:499-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×4
  • Duplicated block (19 lines × 2) hftbacktest/src/backtest/models/queue.rs:791 — hftbacktest/src/backtest/models/queue.rs:791-809 | hftbacktest/src/backtest/models/queue.rs:832-850 — both copies are in the same file, so extract the block into 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) hftbacktest/src/backtest/models/queue.rs:811 — hftbacktest/src/backtest/models/queue.rs:811-829 | hftbacktest/src/backtest/models/queue.rs:852-870 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) hftbacktest/src/depth/fuse.rs:406 — hftbacktest/src/depth/fuse.rs:406-424 | hftbacktest/src/depth/fuse.rs:541-559 — both copies are in the same file, so extract the block into 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) hftbacktest/src/depth/fuse.rs:433 — hftbacktest/src/depth/fuse.rs:433-451 | hftbacktest/src/depth/fuse.rs:514-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · L3FIFOQueueModel · ×3
  • L3FIFOQueueModel::modify_backtest_order (cyclomatic 17) hftbacktest/src/backtest/models/queue.rs:775 — L3FIFOQueueModel::modify_backtest_order has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::modify_market_feed_order) 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.
  • L3FIFOQueueModel::modify_market_feed_order (cyclomatic 17) hftbacktest/src/backtest/models/queue.rs:877 — L3FIFOQueueModel::modify_market_feed_order has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (L3FIFOQueueModel::modify_backtest_order) 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.
  • L3FIFOQueueModel::fill_market_feed_order (cyclomatic 16) hftbacktest/src/backtest/models/queue.rs:974 — L3FIFOQueueModel::fill_market_feed_order has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · ROIVectorMarketDepth · ×3
  • ROIVectorMarketDepth::modify_order (cognitive 80) hftbacktest/src/depth/roivectormarketdepth.rs:634 — ROIVectorMarketDepth::modify_order has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (74 pts), boolean chains 6 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ROIVectorMarketDepth::clear_depth (cognitive 43) hftbacktest/src/depth/roivectormarketdepth.rs:273 — ROIVectorMarketDepth::clear_depth has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (34 pts), loops 2 (8 pts), match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ROIVectorMarketDepth::delete_order (cognitive 32) hftbacktest/src/depth/roivectormarketdepth.rs:574 — ROIVectorMarketDepth::delete_order has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (30 pts), boolean chains 2 (nesting depth added 20). 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.
D3 · God Classes · TooManyFields · ×3
  • TooManyFields: ExecutionReport connector/src/binancespot/msg/stream.rs:243 — TooManyFields — 50 stored fields. The bar is 30 stored fields; this is 20 over it, 1.67× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: PrivateOrder connector/src/bybit/msg.rs:427 — TooManyFields — 42 stored fields. The bar is 30 stored fields; this is 12 over it, 1.40× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Position connector/src/bybit/msg.rs:263 — TooManyFields — 34 stored fields. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) connector/src/binancefutures/ordermanager.rs:311 — connector/src/binancefutures/ordermanager.rs:311-340 | connector/src/binancespot/ordermanager.rs:296-325 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (30 lines × 2) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:174 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:174-203 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:316-345 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:437 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:437-466 | hftbacktest/src/backtest/proc/partialfillexchange.rs:655-684 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×3
  • Duplicated block (13 lines × 3) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:113 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:113-125 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:171-183 | hftbacktest/src/backtest/proc/partialfillexchange.rs:216-228 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) hftbacktest/src/depth/roivectormarketdepth.rs:182 — hftbacktest/src/depth/roivectormarketdepth.rs:182-194 | hftbacktest/src/depth/roivectormarketdepth.rs:526-538 | hftbacktest/src/depth/roivectormarketdepth.rs:679-691 — 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 (13 lines × 3) hftbacktest/src/depth/roivectormarketdepth.rs:249 — hftbacktest/src/depth/roivectormarketdepth.rs:249-261 | hftbacktest/src/depth/roivectormarketdepth.rs:558-570 | hftbacktest/src/depth/roivectormarketdepth.rs:737-749 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) hftbacktest/src/depth/btreemarketdepth.rs:258 — hftbacktest/src/depth/btreemarketdepth.rs:258-267 | hftbacktest/src/depth/hashmapmarketdepth.rs:397-406 | hftbacktest/src/depth/roivectormarketdepth.rs:517-526 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (10 lines × 3) hftbacktest/src/depth/btreemarketdepth.rs:280 — hftbacktest/src/depth/btreemarketdepth.rs:280-289 | hftbacktest/src/depth/hashmapmarketdepth.rs:424-433 | hftbacktest/src/depth/roivectormarketdepth.rs:549-558 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (10 lines × 3) examples/example_bybit.py:11 — examples/example_bybit.py:11-20 | examples/example_hyperliquid.py:10-19 | examples/example_mexc.py:10-19 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) hftbacktest/src/depth/fuse.rs:310 — hftbacktest/src/depth/fuse.rs:310-317 | hftbacktest/src/depth/hashmapmarketdepth.rs:201-209 — before extracting anything, compare `hftbacktest/src/depth/fuse.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8–9 lines × 2) hftbacktest/src/depth/fuse.rs:323 — hftbacktest/src/depth/fuse.rs:323-330 | hftbacktest/src/depth/hashmapmarketdepth.rs:221-229 — before extracting anything, compare `hftbacktest/src/depth/fuse.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8–9 lines × 2) hftbacktest/examples/4_latency.py:48 — hftbacktest/examples/4_latency.py:48-56 | py-hftbacktest/hftbacktest/data/utils/feed_order_latency.py:74-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hftbacktest/examples/4_latency.py:48` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×3
  • Duplicated block (8 lines × 3) collector/src/binance/mod.rs:20 — collector/src/binance/mod.rs:20-27 | collector/src/binancefuturescm/mod.rs:20-27 | collector/src/binancefuturesum/mod.rs:20-27 — `collector/src/binance/mod.rs` and `collector/src/binancefuturescm/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 53 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 3) hftbacktest/src/depth/btreemarketdepth.rs:338 — hftbacktest/src/depth/btreemarketdepth.rs:338-345 | hftbacktest/src/depth/hashmapmarketdepth.rs:495-502 | hftbacktest/src/depth/roivectormarketdepth.rs:641-648 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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 (8 lines × 3) py-hftbacktest/hftbacktest/data/utils/tardis.py:260 — py-hftbacktest/hftbacktest/data/utils/tardis.py:260-267 | py-hftbacktest/hftbacktest/data/utils/tardis.py:270-277 | py-hftbacktest/hftbacktest/data/utils/tardis.py:315-322 — 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.
D1 · Cyclomatic Complexity · PartialFillExchange · ×2
  • PartialFillExchange::ack_new (cyclomatic 51) hftbacktest/src/backtest/proc/partialfillexchange.rs:387 — PartialFillExchange::ack_new has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This file is where this pass's cyclomatic complexity CONCENTRATES: hftbacktest/src/backtest/proc/partialfillexchange.rs holds 2 of the 28 functions over the threshold — including the worst — and 47 of the 162 points over it (29%), 2.5× the next-largest file (py-hftbacktest/hftbacktest/data/utils/difforderbooksnapshot.py at 19). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • PartialFillExchange::process (cyclomatic 26) hftbacktest/src/backtest/proc/partialfillexchange.rs:747 — PartialFillExchange::process has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This file is where this pass's cyclomatic complexity CONCENTRATES: hftbacktest/src/backtest/proc/partialfillexchange.rs holds 2 of the 28 functions over the threshold — including the worst — and 47 of the 162 points over it (29%), 2.5× the next-largest file (py-hftbacktest/hftbacktest/data/utils/difforderbooksnapshot.py at 19). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D1 · Cyclomatic Complexity · NoPartialFillExchange · ×2
  • NoPartialFillExchange::process (cyclomatic 26) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:529 — NoPartialFillExchange::process 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.
  • NoPartialFillExchange::ack_new (cyclomatic 17) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:314 — NoPartialFillExchange::ack_new has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ROIVectorMarketDepth · ×2
  • ROIVectorMarketDepth::modify_order (cyclomatic 26) hftbacktest/src/depth/roivectormarketdepth.rs:634 — ROIVectorMarketDepth::modify_order 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.
  • ROIVectorMarketDepth::clear_depth (cyclomatic 18) hftbacktest/src/depth/roivectormarketdepth.rs:273 — ROIVectorMarketDepth::clear_depth has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UserDataStream · ×2
  • UserDataStream::connect (cyclomatic 21) connector/src/binancespot/user_data_stream.rs:114 — UserDataStream::connect has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UserDataStream::connect (cyclomatic 20) connector/src/binancefutures/user_data_stream.rs:115 — UserDataStream::connect has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · L3NoPartialFillExchange · ×2
  • L3NoPartialFillExchange::process (cyclomatic 20) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:340 — L3NoPartialFillExchange::process 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.
  • L3NoPartialFillExchange::ack_new (cyclomatic 17) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:172 — L3NoPartialFillExchange::ack_new has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FusedHashMapMarketDepth · ×2
  • FusedHashMapMarketDepth::update_bid_depth (cyclomatic 17) hftbacktest/src/depth/fuse.rs:75 — FusedHashMapMarketDepth::update_bid_depth has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_ask_depth) 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.
  • FusedHashMapMarketDepth::update_ask_depth (cyclomatic 17) hftbacktest/src/depth/fuse.rs:191 — FusedHashMapMarketDepth::update_ask_depth has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (FusedHashMapMarketDepth::update_bid_depth) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PrivateStream · ×2
  • PrivateStream::handle_private_stream (cognitive 50) connector/src/bybit/private_stream.rs:69 — PrivateStream::handle_private_stream has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 5 (13 pts), loops 5 (12 pts) (nesting depth added 31). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PrivateStream::connect (cognitive 21) connector/src/bybit/private_stream.rs:246 — PrivateStream::connect has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 2 (8 pts), loops 1 (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BTreeMarketDepth · ×2
  • BTreeMarketDepth::clear_depth (cognitive 31) hftbacktest/src/depth/btreemarketdepth.rs:117 — BTreeMarketDepth::clear_depth has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (8 pts), match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • BTreeMarketDepth::modify_order (cognitive 28) hftbacktest/src/depth/btreemarketdepth.rs:331 — BTreeMarketDepth::modify_order has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (28 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · UserDataStream · ×2
  • UserDataStream::connect (cognitive 30) connector/src/binancespot/user_data_stream.rs:114 — UserDataStream::connect has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 4 (12 pts), loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UserDataStream::connect (cognitive 27) connector/src/binancefutures/user_data_stream.rs:115 — UserDataStream::connect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 4 (12 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · L3NoPartialFillExchange · ×2
  • L3NoPartialFillExchange::process (cognitive 30) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:340 — L3NoPartialFillExchange::process has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (9 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.
  • L3NoPartialFillExchange::ack_new (cognitive 25) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:172 — L3NoPartialFillExchange::ack_new has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 7 (11 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LiveBot · ×2
  • LiveBot::process_event (cognitive 30) hftbacktest/src/live/bot.rs:205 — LiveBot::process_event has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LiveBot::elapse_ (cognitive 20) hftbacktest/src/live/bot.rs:290 — LiveBot::elapse_ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · connector · ×2
  • connector::run_publish_task (cognitive 27) connector/src/main.rs:117 — connector::run_publish_task has cognitive complexity 27 (threshold 15). Drivers by points: loops 4 (14 pts), match/switch 3 (9 pts), if/else 1 (4 pts) (nesting depth added 19). 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.
  • connector::handle_ev (cognitive 21) connector/src/main.rs:213 — connector::handle_ev has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 6 (8 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · MethodTooLong · ×2
  • MethodTooLong: PartialFillExchange.ack_new hftbacktest/src/backtest/proc/partialfillexchange.rs:387 — MethodTooLong — ack_new runs 176 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PrivateStream.handle_private_stream connector/src/bybit/private_stream.rs:69 — MethodTooLong — handle_private_stream runs 124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×2
  • Duplicated block (33 lines × 2) hftbacktest/src/backtest/mod.rs:255 — hftbacktest/src/backtest/mod.rs:255-287 | hftbacktest/src/backtest/mod.rs:477-509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) hftbacktest/src/depth/fuse.rs:96 — hftbacktest/src/depth/fuse.rs:96-128 | hftbacktest/src/depth/fuse.rs:212-244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) connector/src/binancefutures/ordermanager.rs:165 — connector/src/binancefutures/ordermanager.rs:165-191 | connector/src/binancespot/ordermanager.rs:150-176 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (27 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:127 — hftbacktest/src/backtest/proc/l3_local.rs:127-153 | hftbacktest/src/backtest/proc/local.rs:188-214 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) hftbacktest/src/backtest/models/queue.rs:1010 — hftbacktest/src/backtest/models/queue.rs:1010-1033 | hftbacktest/src/backtest/models/queue.rs:1051-1074 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:95 — hftbacktest/src/backtest/proc/l3_local.rs:95-118 | hftbacktest/src/backtest/proc/local.rs:156-179 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×2
  • Duplicated block (21 lines × 2) connector/src/binancefutures/market_data_stream.rs:283 — connector/src/binancefutures/market_data_stream.rs:283-303 | connector/src/binancespot/market_data_stream.rs:283-303 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (21 lines × 2) connector/src/binancefutures/ordermanager.rs:219 — connector/src/binancefutures/ordermanager.rs:219-239 | connector/src/binancespot/ordermanager.rs:204-224 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×2
  • Duplicated block (20 lines × 2) hftbacktest/src/backtest/mod.rs:290 — hftbacktest/src/backtest/mod.rs:290-309 | hftbacktest/src/backtest/mod.rs:512-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.
  • Duplicated block (20 lines × 2) hftbacktest/src/backtest/proc/partialfillexchange.rs:147 — hftbacktest/src/backtest/proc/partialfillexchange.rs:147-166 | hftbacktest/src/backtest/proc/partialfillexchange.rs:187-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) hftbacktest/src/depth/hashmapmarketdepth.rs:397 — hftbacktest/src/depth/hashmapmarketdepth.rs:397-409 | hftbacktest/src/depth/roivectormarketdepth.rs:517-531 — before extracting anything, compare `hftbacktest/src/depth/hashmapmarketdepth.rs` and `hftbacktest/src/depth/roivectormarketdepth.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13–15 lines × 2) hftbacktest/src/depth/hashmapmarketdepth.rs:424 — hftbacktest/src/depth/hashmapmarketdepth.rs:424-436 | hftbacktest/src/depth/roivectormarketdepth.rs:549-563 — before extracting anything, compare `hftbacktest/src/depth/hashmapmarketdepth.rs` and `hftbacktest/src/depth/roivectormarketdepth.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:212 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:212-221 | hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:262-271 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:361-370 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:418-427 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) py-hftbacktest/hftbacktest/data/utils/tardis.py:147 — py-hftbacktest/hftbacktest/data/utils/tardis.py:147-156 | py-hftbacktest/hftbacktest/data/utils/tardis.py:177-186 | py-hftbacktest/hftbacktest/data/utils/tardis.py:527-536 | py-hftbacktest/hftbacktest/data/utils/tardis.py:582-591 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-hftbacktest/hftbacktest/data/utils/tardis.py:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×2
  • Duplicated block (7 lines × 3) connector/src/binancefutures/rest.rs:176 — connector/src/binancefutures/rest.rs:176-182 | connector/src/binancefutures/rest.rs:255-261 | connector/src/binancespot/rest.rs:208-214 — `connector/src/binancefutures/rest.rs` and `connector/src/binancespot/rest.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 3) connector/src/bybit/mod.rs:131 — connector/src/bybit/mod.rs:131-137 | connector/src/bybit/mod.rs:177-186 | connector/src/bybit/mod.rs:228-234 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×2
  • Low cohesion: RiskAdverseQueueModel (LCOM4 4) hftbacktest/src/backtest/models/queue.rs:44 — RiskAdverseQueueModel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ProbQueueModel (LCOM4 4) hftbacktest/src/backtest/models/queue.rs:139 — ProbQueueModel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D1 · Cyclomatic Complexity · DiffOrderBookSnapshot.snapshot (cyclomatic 34) · ×1
  • DiffOrderBookSnapshot.snapshot (cyclomatic 34) py-hftbacktest/hftbacktest/data/utils/difforderbooksnapshot.py:51 — DiffOrderBookSnapshot.snapshot has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrivateStream · ×1
  • PrivateStream::handle_private_stream (cyclomatic 23) connector/src/bybit/private_stream.rs:69 — PrivateStream::handle_private_stream has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiveBot · ×1
  • LiveBot::process_event (cyclomatic 21) hftbacktest/src/live/bot.rs:205 — LiveBot::process_event has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · binancefutures.convert (cyclomatic 21) · ×1
  • binancefutures.convert (cyclomatic 21) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:20 — binancefutures.convert has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hyperliquid.convert (cyclomatic 20) · ×1
  • hyperliquid.convert (cyclomatic 20) py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:23 — hyperliquid.convert has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hftbacktest_derive · ×1
  • hftbacktest_derive::dtype_derive (cyclomatic 18) hftbacktest-derive/src/lib.rs:19 — hftbacktest_derive::dtype_derive has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · binancehistmktdata.convert (cyclomatic 18) · ×1
  • binancehistmktdata.convert (cyclomatic 18) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:134 — binancehistmktdata.convert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bybithistmktdata.convert (cyclomatic 18) · ×1
  • bybithistmktdata.convert (cyclomatic 18) py-hftbacktest/hftbacktest/data/utils/bybithistmktdata.py:15 — bybithistmktdata.convert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · collector · ×1
  • collector::hyperliquid::http::connect (cyclomatic 17) collector/src/hyperliquid/http.rs:20 — collector::hyperliquid::http::connect has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Backtest · ×1
  • Backtest::goto (cyclomatic 17) hftbacktest/src/backtest/mod.rs:755 — Backtest::goto has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · databento.convert (cyclomatic 17) · ×1
  • databento.convert (cyclomatic 17) py-hftbacktest/hftbacktest/data/utils/databento.py:22 — databento.convert has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · mexc.convert (cyclomatic 16) · ×1
  • mexc.convert (cyclomatic 16) py-hftbacktest/hftbacktest/data/utils/mexc.py:17 — mexc.convert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tardis.convert (cyclomatic 16) · ×1
  • tardis.convert (cyclomatic 16) py-hftbacktest/hftbacktest/data/utils/tardis.py:56 — tardis.convert 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×1
  • Hotspot: collector/src/hyperliquid/http.rs collector/src/hyperliquid/http.rs:20 — collector/src/hyperliquid/http.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in collector::hyperliquid::http::connect at line 20. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2025-09-24..2025-12-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2025-09-24 10:31:05 -05:00' --until='2025-12-23 10:31:05 -05:00' --full-history --no-merges -- collector/src/hyperliquid/http.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D2 · Cognitive Complexity · DiffOrderBookSnapshot.snapshot (cognitive 67) · ×1
  • DiffOrderBookSnapshot.snapshot (cognitive 67) py-hftbacktest/hftbacktest/data/utils/difforderbooksnapshot.py:51 — DiffOrderBookSnapshot.snapshot has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (48 pts), loops 12 (18 pts), boolean chains 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bybithistmktdata.convert (cognitive 54) · ×1
  • bybithistmktdata.convert (cognitive 54) py-hftbacktest/hftbacktest/data/utils/bybithistmktdata.py:15 — bybithistmktdata.convert has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (29 pts), ternaries 4 (17 pts), loops 4 (8 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · binancehistmktdata.convert (cognitive 49) · ×1
  • binancehistmktdata.convert (cognitive 49) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:134 — binancehistmktdata.convert has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (43 pts), ternaries 2 (4 pts), loops 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · binancefutures.convert (cognitive 45) · ×1
  • binancefutures.convert (cognitive 45) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:20 — binancefutures.convert has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 5 (17 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hyperliquid.convert (cognitive 45) · ×1
  • hyperliquid.convert (cognitive 45) py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:23 — hyperliquid.convert has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 6 (16 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _Fuse.process_depth (cognitive 39) · ×1
  • _Fuse.process_depth (cognitive 39) py-hftbacktest/hftbacktest/data/utils/tardis.py:341 — _Fuse.process_depth has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (11 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mexc.convert (cognitive 37) · ×1
  • mexc.convert (cognitive 37) py-hftbacktest/hftbacktest/data/utils/mexc.py:17 — mexc.convert has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 6 (16 pts), ternaries 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.
D2 · Cognitive Complexity · hftbacktest_derive · ×1
  • hftbacktest_derive::build_asset (cognitive 35) hftbacktest-derive/src/lib.rs:182 — hftbacktest_derive::build_asset has cognitive complexity 35 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 4 (14 pts), match/switch 1 (6 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Backtest · ×1
  • Backtest::goto (cognitive 33) hftbacktest/src/backtest/mod.rs:755 — Backtest::goto has cognitive complexity 33 (threshold 15). Drivers by points: if/else 4 (16 pts), match/switch 5 (14 pts), loops 2, 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.
D2 · Cognitive Complexity · Local · ×1
  • Local::process_recv_order_ (cognitive 32) hftbacktest/src/backtest/proc/local.rs:76 — Local::process_recv_order_ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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.
D2 · Cognitive Complexity · bybit._convert_depth (cognitive 30) · ×1
  • bybit._convert_depth (cognitive 30) py-hftbacktest/hftbacktest/data/utils/bybit.py:242 — bybit._convert_depth has cognitive complexity 30 (threshold 15). Drivers by points: loops 5 (16 pts), if/else 5 (11 pts), ternaries 1 (3 pts) (nesting depth added 19). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · tardis._convert_depth (cognitive 30) · ×1
  • tardis._convert_depth (cognitive 30) py-hftbacktest/hftbacktest/data/utils/tardis.py:239 — tardis._convert_depth has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · binancehistmktdata.convert_snapshot (cognitive 28) · ×1
  • binancehistmktdata.convert_snapshot (cognitive 28) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:19 — binancehistmktdata.convert_snapshot has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PublicStream · ×1
  • PublicStream::handle_public_stream (cognitive 25) connector/src/bybit/public_stream.rs:50 — PublicStream::handle_public_stream has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 5 (9 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · L3Local · ×1
  • L3Local::process_recv_order (cognitive 25) hftbacktest/src/backtest/proc/l3_local.rs:259 — L3Local::process_recv_order has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · bybit.convert_fused (cognitive 23) · ×1
  • bybit.convert_fused (cognitive 23) py-hftbacktest/hftbacktest/data/utils/bybit.py:111 — bybit.convert_fused has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (5 pts), ternaries 1 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IceoryxUnifiedChannel · ×1
  • IceoryxUnifiedChannel::recv_timeout (cognitive 22) hftbacktest/src/live/ipc/iceoryx.rs:326 — IceoryxUnifiedChannel::recv_timeout has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · py_hftbacktest · ×1
  • py_hftbacktest::fuse::fusemarketdepth_process_event (cognitive 22) py-hftbacktest/src/fuse.rs:41 — py_hftbacktest::fuse::fusemarketdepth_process_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (22 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tardis.convert (cognitive 20) · ×1
  • tardis.convert (cognitive 20) py-hftbacktest/hftbacktest/data/utils/tardis.py:56 — tardis.convert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NpyHeader · ×1
  • NpyHeader::from_header (cognitive 18) hftbacktest/src/backtest/data/npy/mod.rs:62 — NpyHeader::from_header has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (11 pts), loops 3 (7 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IntpOrderLatency · ×1
  • IntpOrderLatency::entry (cognitive 18) hftbacktest/src/backtest/models/latency.rs:171 — IntpOrderLatency::entry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · databento.convert (cognitive 16) · ×1
  • databento.convert (cognitive 16) py-hftbacktest/hftbacktest/data/utils/databento.py:22 — databento.convert has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
D22 · Internal API Consistency · Redundant operations for setting cache entries. `insert` and `set` appear to perform the same function (storing data under a key), creating confusion about which to use or if they have different side effects (e.g., overwrite vs. ignore existing). · ×1
  • Redundant operations for setting cache entries. `insert` and `set` appear to perform the same function (storing data under a key), creating confusion about which to use or if they have different side effects (e.g., overwrite vs. ignore existing). — Remove `insert` and keep `set`, or vice versa, to provide a single canonical method for storing data in the cache. (signatures: Cache.insert(key: String, data: Data) | Cache.set(key: str, data: Data))
D22 · Internal API Consistency · Inconsistent order submission API. `submit_buy_order` and `submit_sell_order` are convenience methods that duplicate the functionality of `submit_order` when an `OrderRequest` with a `Side` is provided. This forces users to choose between a verbose specific method or a generic one, and creates API surface bloat. · ×1
  • Inconsistent order submission API. `submit_buy_order` and `submit_sell_order` are convenience methods that duplicate the functionality of `submit_order` when an `OrderRequest` with a `Side` is provided. This forces users to choose between a verbose specific method or a generic one, and creates API surface bloat. — Remove `submit_buy_order` and `submit_sell_order`, relying solely on `submit_order` with the `Side` field in `OrderRequest` to determine direction. (signatures: Bot.submit_buy_order(...) | Bot.submit_sell_order(...) | Bot.submit_order(asset_no: usize, order: OrderRequest, wait: bool))
D22 · Internal API Consistency · Conflicting accessors for the same property. `descr` is exposed as both a property returning a typed `DType` and a method returning a `String`. This is inconsistent with Rust conventions (properties are fields/getters, methods are actions) and creates ambiguity on how to access the description. · ×1
  • Conflicting accessors for the same property. `descr` is exposed as both a property returning a typed `DType` and a method returning a `String`. This is inconsistent with Rust conventions (properties are fields/getters, methods are actions) and creates ambiguity on how to access the description. — Keep the property `descr: DType` for typed access and remove the method `descr(): String`, or rename the method to `descr_str()` if string representation is needed. (signatures: NpyHeader.descr(): String | NpyHeader.descr: DType)
D22 · Internal API Consistency · Ambiguous naming for time progression. `elapse` and `elapse_bt` (likely 'backtest') suggest similar functionality (advancing time), but the distinction is unclear from the names alone. It is not immediately obvious if `elapse_bt` is a specialized version or if one is deprecated. · ×1
  • Ambiguous naming for time progression. `elapse` and `elapse_bt` (likely 'backtest') suggest similar functionality (advancing time), but the distinction is unclear from the names alone. It is not immediately obvious if `elapse_bt` is a specialized version or if one is deprecated. — Rename `elapse_bt` to `elapse_backtest` or `elapse_simulation` for clarity, or unify them if they serve the exact same purpose. (signatures: Bot.elapse(duration: i64) | Bot.elapse_bt(duration: i64))
D3 · God Classes · TooManyFunctions · ×1
  • TooManyFunctions: py_hftbacktest::live py-hftbacktest/src/live.rs:15 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D3 · God Classes · FunctionTooLong · ×1
  • FunctionTooLong: hftbacktest_derive::build_asset hftbacktest-derive/src/lib.rs:182 — FunctionTooLong — hftbacktest_derive::build_asset runs 111 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (89 shared lines) · ×1
  • Near-duplicate member pair (89 shared lines) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:172 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:172-278 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:314-434 — These two members are variants of one another: 89 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) hftbacktest/src/depth/fuse.rs:347 — hftbacktest/src/depth/fuse.rs:347-453 | hftbacktest/src/depth/fuse.rs:455-561 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (32 shared lines) · ×1
  • Near-duplicate member pair (32 shared lines) hftbacktest/src/depth/btreemarketdepth.rs:337 — hftbacktest/src/depth/btreemarketdepth.rs:337-401 | hftbacktest/src/depth/hashmapmarketdepth.rs:494-576 — These two members are variants of one another: 32 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) hftbacktest/src/live/ipc/iceoryx.rs:76 — hftbacktest/src/live/ipc/iceoryx.rs:76-115 | hftbacktest/src/live/ipc/iceoryx.rs:117-157 — These two members are variants of one another: 24 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 (73 corresponding lines) · ×1
  • Edited copy of a member (73 corresponding lines) connector/src/binancefutures/mod.rs:236 — connector/src/binancefutures/mod.rs:236-308 | connector/src/binancespot/mod.rs:239-311 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:28 — py-hftbacktest/hftbacktest/data/utils/binancefutures.py:28-297 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:144-303 | py-hftbacktest/hftbacktest/data/utils/bybithistmktdata.py:25-175 | py-hftbacktest/hftbacktest/data/utils/databento.py:29-127 | py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:34-181 | py-hftbacktest/hftbacktest/data/utils/mexc.py:24-197 | py-hftbacktest/hftbacktest/data/utils/tardis.py:64-231 | py-hftbacktest/hftbacktest/data/utils/tardis.py:483-640 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) connector/src/binancefutures/market_data_stream.rs:265 — connector/src/binancefutures/market_data_stream.rs:265-337 | connector/src/binancefutures/user_data_stream.rs:115-234 | connector/src/binancespot/market_data_stream.rs:265-337 | connector/src/binancespot/user_data_stream.rs:114-248 | connector/src/bybit/private_stream.rs:246-360 | connector/src/bybit/public_stream.rs:166-243 | connector/src/bybit/trade_stream.rs:61-158 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Duplicated block (64 lines × 3) · ×1
  • Duplicated block (64 lines × 3) collector/src/binance/http.rs:62 — collector/src/binance/http.rs:62-125 | collector/src/binancefuturescm/http.rs:63-126 | collector/src/binancefuturesum/http.rs:63-126 — `collector/src/binance/http.rs` and `collector/src/binancefuturescm/http.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) connector/src/binancefutures/market_data_stream.rs:69 — connector/src/binancefutures/market_data_stream.rs:69-114 | connector/src/binancespot/market_data_stream.rs:69-114 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:473 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:473-514 | hftbacktest/src/backtest/proc/partialfillexchange.rs:691-732 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:213 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:213-253 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:362-402 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:530 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:530-568 | hftbacktest/src/backtest/proc/partialfillexchange.rs:748-786 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) py-hftbacktest/src/lib.rs:531 — py-hftbacktest/src/lib.rs:531-568 | py-hftbacktest/src/lib.rs:588-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) hftbacktest/src/backtest/proc/l3_local.rs:265 — hftbacktest/src/backtest/proc/l3_local.rs:265-300 | hftbacktest/src/backtest/proc/local.rs:85-120 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_local.rs` and `hftbacktest/src/backtest/proc/local.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 123 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (34 lines × 3) · ×1
  • Duplicated block (34 lines × 3) hftbacktest/src/depth/btreemarketdepth.rs:404 — hftbacktest/src/depth/btreemarketdepth.rs:404-437 | hftbacktest/src/depth/hashmapmarketdepth.rs:579-612 | hftbacktest/src/depth/roivectormarketdepth.rs:765-798 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) collector/src/binancefuturescm/mod.rs:21 — collector/src/binancefuturescm/mod.rs:21-51 | collector/src/binancefuturesum/mod.rs:21-51 — `collector/src/binancefuturescm/mod.rs` and `collector/src/binancefuturesum/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 84 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×1
  • Duplicated block (28 lines × 3) collector/src/binance/mod.rs:44 — collector/src/binance/mod.rs:44-71 | collector/src/binancefuturescm/mod.rs:46-73 | collector/src/binancefuturesum/mod.rs:46-73 — `collector/src/binance/mod.rs` and `collector/src/binancefuturescm/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 53 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) connector/src/binancefutures/user_data_stream.rs:173 — connector/src/binancefutures/user_data_stream.rs:173-200 | connector/src/binancespot/user_data_stream.rs:175-202 — `connector/src/binancefutures/user_data_stream.rs` and `connector/src/binancespot/user_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 79 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:114 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:114-138 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:172-196 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22–24 lines × 3) · ×1
  • Duplicated block (22–24 lines × 3) connector/src/bybit/private_stream.rs:339 — connector/src/bybit/private_stream.rs:339-360 | connector/src/bybit/public_stream.rs:220-243 | connector/src/bybit/trade_stream.rs:137-158 — before extracting anything, compare `connector/src/bybit/private_stream.rs` and `connector/src/bybit/trade_stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:417 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:417-439 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:614-636 | hftbacktest/src/backtest/proc/partialfillexchange.rs:832-854 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) connector/src/binancefutures/ordermanager.rs:248 — connector/src/binancefutures/ordermanager.rs:248-270 | connector/src/binancespot/ordermanager.rs:233-255 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (21 lines × 4) · ×1
  • Duplicated block (21 lines × 4) collector/src/binance/http.rs:152 — collector/src/binance/http.rs:152-172 | collector/src/binancefuturescm/http.rs:153-173 | collector/src/binancefuturesum/http.rs:153-173 | collector/src/bybit/http.rs:128-148 — `collector/src/binance/http.rs` and `collector/src/binancefuturescm/http.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:352 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:352-369 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:409-426 | hftbacktest/src/backtest/proc/partialfillexchange.rs:484-501 | hftbacktest/src/backtest/proc/partialfillexchange.rs:614-631 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) collector/src/binance/http.rs:132 — collector/src/binance/http.rs:132-149 | collector/src/binancefuturescm/http.rs:133-150 | collector/src/binancefuturesum/http.rs:133-150 — `collector/src/binance/http.rs` and `collector/src/binancefuturescm/http.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (16–17 lines × 3) · ×1
  • Duplicated block (16–17 lines × 3) collector/src/binance/mod.rs:83 — collector/src/binance/mod.rs:83-99 | collector/src/binancefuturescm/mod.rs:84-99 | collector/src/binancefuturesum/mod.rs:84-99 — `collector/src/binance/mod.rs` and `collector/src/binancefuturescm/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 53 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) connector/src/binancefutures/ordermanager.rs:183 — connector/src/binancefutures/ordermanager.rs:183-197 | connector/src/binancefutures/ordermanager.rs:231-245 | connector/src/binancespot/ordermanager.rs:168-182 | connector/src/binancespot/ordermanager.rs:216-230 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) py-hftbacktest/src/lib.rs:516 — py-hftbacktest/src/lib.rs:516-529 | py-hftbacktest/src/lib.rs:572-586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:182 — hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:182-195 | hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs:232-245 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:324-337 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:381-394 — before extracting anything, compare `hftbacktest/src/backtest/proc/l3_nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) connector/src/binancefutures/rest.rs:227 — connector/src/binancefutures/rest.rs:227-240 | connector/src/binancefutures/rest.rs:314-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.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) connector/src/binancefutures/market_data_stream.rs:134 — connector/src/binancefutures/market_data_stream.rs:134-146 | connector/src/binancefutures/market_data_stream.rs:217-229 | connector/src/binancespot/market_data_stream.rs:134-146 | connector/src/binancespot/market_data_stream.rs:217-229 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) hftbacktest/src/backtest/proc/partialfillexchange.rs:508 — hftbacktest/src/backtest/proc/partialfillexchange.rs:508-519 | hftbacktest/src/backtest/proc/partialfillexchange.rs:639-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) hftbacktest/src/backtest/proc/partialfillexchange.rs:441 — hftbacktest/src/backtest/proc/partialfillexchange.rs:441-452 | hftbacktest/src/backtest/proc/partialfillexchange.rs:506-517 | hftbacktest/src/backtest/proc/partialfillexchange.rs:569-580 | hftbacktest/src/backtest/proc/partialfillexchange.rs:637-648 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:118 — hftbacktest/src/depth/btreemarketdepth.rs:118-128 | hftbacktest/src/depth/hashmapmarketdepth.rs:197-208 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) hftbacktest/src/depth/btreemarketdepth.rs:135 — hftbacktest/src/depth/btreemarketdepth.rs:135-144 | hftbacktest/src/depth/hashmapmarketdepth.rs:218-228 — before extracting anything, compare `hftbacktest/src/depth/btreemarketdepth.rs` and `hftbacktest/src/depth/hashmapmarketdepth.rs` as WHOLE FILES: this scan already matched 13 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×1
  • Duplicated block (9 lines × 3) connector/src/binancefutures/ordermanager.rs:345 — connector/src/binancefutures/ordermanager.rs:345-353 | connector/src/binancespot/ordermanager.rs:330-338 | connector/src/bybit/ordermanager.rs:229-237 — `connector/src/binancefutures/ordermanager.rs` and `connector/src/binancespot/ordermanager.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 183 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6–8 lines × 7) · ×1
  • Duplicated block (6–8 lines × 7) connector/src/binancefutures/market_data_stream.rs:322 — connector/src/binancefutures/market_data_stream.rs:322-327 | connector/src/binancefutures/user_data_stream.rs:219-224 | connector/src/binancespot/market_data_stream.rs:322-327 | connector/src/binancespot/user_data_stream.rs:233-238 | connector/src/bybit/private_stream.rs:344-349 | connector/src/bybit/public_stream.rs:225-232 | connector/src/bybit/trade_stream.rs:142-147 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) hftbacktest/src/backtest/proc/partialfillexchange.rs:441 — hftbacktest/src/backtest/proc/partialfillexchange.rs:441-448 | hftbacktest/src/backtest/proc/partialfillexchange.rs:457-464 | hftbacktest/src/backtest/proc/partialfillexchange.rs:506-513 | hftbacktest/src/backtest/proc/partialfillexchange.rs:569-576 | hftbacktest/src/backtest/proc/partialfillexchange.rs:585-592 | hftbacktest/src/backtest/proc/partialfillexchange.rs:637-644 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:221 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:221-228 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:233-240 | hftbacktest/src/backtest/proc/partialfillexchange.rs:270-277 | hftbacktest/src/backtest/proc/partialfillexchange.rs:282-289 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) connector/src/bybit/mod.rs:176 — connector/src/bybit/mod.rs:176-183 | connector/src/bybit/mod.rs:227-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) connector/src/binancefutures/market_data_stream.rs:105 — connector/src/binancefutures/market_data_stream.rs:105-111 | connector/src/binancefutures/market_data_stream.rs:188-194 | connector/src/binancespot/market_data_stream.rs:105-111 | connector/src/binancespot/market_data_stream.rs:188-194 — `connector/src/binancefutures/market_data_stream.rs` and `connector/src/binancespot/market_data_stream.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 188 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×1
  • Duplicated block (6 lines × 3) py-hftbacktest/src/live.rs:21 — py-hftbacktest/src/live.rs:21-26 | py-hftbacktest/src/live.rs:78-83 | py-hftbacktest/src/live.rs:321-326 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) hftbacktest/src/backtest/proc/nopartialfillexchange.rs:553 — hftbacktest/src/backtest/proc/nopartialfillexchange.rs:553-557 | hftbacktest/src/backtest/proc/nopartialfillexchange.rs:579-583 | hftbacktest/src/backtest/proc/partialfillexchange.rs:771-775 | hftbacktest/src/backtest/proc/partialfillexchange.rs:797-801 — before extracting anything, compare `hftbacktest/src/backtest/proc/nopartialfillexchange.rs` and `hftbacktest/src/backtest/proc/partialfillexchange.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 283 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) collector/src/binance/http.rs:22 — collector/src/binance/http.rs:22-32 | collector/src/binancefuturescm/http.rs:22-32 | collector/src/binancefuturesum/http.rs:22-32 — `collector/src/binance/http.rs` and `collector/src/binancefuturescm/http.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (49 lines × 2) · ×1
  • Duplicated block (49 lines × 2) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:28 — py-hftbacktest/hftbacktest/data/utils/binancefutures.py:28-89 | py-hftbacktest/hftbacktest/data/utils/bybit.py:379-427 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (40–44 lines × 3) · ×1
  • Duplicated block (40–44 lines × 3) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:48 — py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:48-91 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:170-212 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:229-268 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30–34 lines × 4) · ×1
  • Duplicated block (30–34 lines × 4) py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:56 — py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:56-88 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:177-209 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:236-265 | py-hftbacktest/hftbacktest/data/utils/bybithistmktdata.py:106-139 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) py-hftbacktest/hftbacktest/data/utils/tardis.py:136 — py-hftbacktest/hftbacktest/data/utils/tardis.py:136-169 | py-hftbacktest/hftbacktest/data/utils/tardis.py:516-549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) py-hftbacktest/hftbacktest/data/utils/tardis.py:180 — py-hftbacktest/hftbacktest/data/utils/tardis.py:180-208 | py-hftbacktest/hftbacktest/data/utils/tardis.py:585-613 — both copies are in the same file, so extract the 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 `py-hftbacktest/hftbacktest/data/utils/tardis.py:180` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–17 lines × 8) · ×1
  • Duplicated block (15–17 lines × 8) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:281 — py-hftbacktest/hftbacktest/data/utils/binancefutures.py:281-297 | py-hftbacktest/hftbacktest/data/utils/binancehistmktdata.py:287-303 | py-hftbacktest/hftbacktest/data/utils/bybithistmktdata.py:161-175 | py-hftbacktest/hftbacktest/data/utils/databento.py:111-127 | py-hftbacktest/hftbacktest/data/utils/hyperliquid.py:165-181 | py-hftbacktest/hftbacktest/data/utils/mexc.py:181-197 | py-hftbacktest/hftbacktest/data/utils/tardis.py:215-231 | py-hftbacktest/hftbacktest/data/utils/tardis.py:624-640 — there are 8 copies across 7 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 8 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) py-hftbacktest/hftbacktest/data/utils/bybit.py:159 — py-hftbacktest/hftbacktest/data/utils/bybit.py:159-173 | py-hftbacktest/hftbacktest/data/utils/bybit.py:419-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `py-hftbacktest/hftbacktest/data/utils/bybit.py:156` calls `_Fuse` and `py-hftbacktest/hftbacktest/data/utils/bybit.py:416` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) py-hftbacktest/hftbacktest/data/utils/binancefutures.py:82 — py-hftbacktest/hftbacktest/data/utils/binancefutures.py:82-90 | py-hftbacktest/hftbacktest/data/utils/bybit.py:158-166 | py-hftbacktest/hftbacktest/data/utils/bybit.py:418-428 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `py-hftbacktest/hftbacktest/data/utils/bybit.py:156` calls `_Fuse` and `py-hftbacktest/hftbacktest/data/utils/binancefutures.py:80` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) py-hftbacktest/hftbacktest/data/utils/tardis.py:145 — py-hftbacktest/hftbacktest/data/utils/tardis.py:145-152 | py-hftbacktest/hftbacktest/data/utils/tardis.py:175-182 | py-hftbacktest/hftbacktest/data/utils/tardis.py:525-532 | py-hftbacktest/hftbacktest/data/utils/tardis.py:556-562 | py-hftbacktest/hftbacktest/data/utils/tardis.py:580-587 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. 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.
P4 · Deployment & Rollback · No deployment automation · ×1
  • No deployment automation — No release automation was found in CI — neither a deploy stage (Helm/Kubernetes/compose manifests, an orchestrated rollout) nor a publish job that ships the built artifact. Releases appear to be run by hand, which is slower, less repeatable and harder to reverse.
Minor — 15 finding(s)
D19 · Documentation Quality · Documentation · ×4
  • Documentation: no installation or build instructions connector/README.md — Getting Started steps clone the repo and build Connector but do not show how to install from crates.io or run a single instance without Cargo. Add an Install section for both cargo add hftbacktest and the development version git clone, plus a short Run/Start command example.
  • Documentation: no usage examples connector/README.md — The Getting Started guide shows how to run multiple Connector instances but does not explain what each instance represents or how to configure them. Add a Usage section describing the required configuration and an example of running one or more bots on the same exchange.
  • Documentation: no architecture or design documentation docs/debugging_backtesting_and_live_discrepancies.rst — The document is a debugging guide but no architecture or model-design documentation exists among the 23 architecture/Docs markdown files. Add an Architecture section describing the backtest models, latency types, and queue models referenced in this doc.
  • Documentation: no architecture or design documentation docs/reference/data_validation.rst — The reference module listing is a reference doc, not architecture/design documentation. Add an architecture section describing the data-flow model and why each referenced class exists.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 19 of 83 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 83 of the 108 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: connector/src/bybit/msg.rs, connector/src/bybit/private_stream.rs, connector/src/binancespot/ordermanager.rs, connector/src/bybit/trade_stream.rs, connector/src/binancefutures/msg/stream.rs, connector/src/binancefutures/msg/rest.rs, hftbacktest/src/utils/aligned.rs, py-hftbacktest/hftbacktest/data/utils/difforderbooksnapshot.py (and 11 more). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P10 · Library API & versioning · Large public API surface · ×1
  • Large public API surface — 107/122 types (88%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a47b9a3801fe4334942e6bae90fbce87/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a47b9a3801fe4334942e6bae90fbce87/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .31artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive .0artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive .0artifacts/raw/osv-scanner.json

Run 01a0f16e-5ae4-75b3-b78f-bb5046128aa4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md