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

MomentsLD/moments

Measured 31 October 2026, 09:36 UTC, at code version 375eddb

No regression since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 56out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 1 since the last survey

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

A medium codebase: 33,693 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 0.3 person-years · Weakest lens: Maturity, 49

Findings by how serious they are

57 critical 541 serious 21 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
31 October 2026, 09:36 UTC

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

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

39of 39 dimensions measured by tools.
608of 619 findings point to an exact file and line, so you can open each one in the code. The other 11 concern the repository as a whole, such as missing documentation.
39dimensions across 5 lenses, read from 33,693 lines of product code in 1 project.
Chapters

Executive summary

MomentsLD/moments falls short of our standard for production because we found no recorded design decisions and no architecture document or diagram. It scores 56 out of 100 and is rated Adequate, and 55 of its 57 critical findings are security problems in the build pipeline and in its code.

Maturity, at 49, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 7 points. Adding automated security scanning comes next, worth about 5 points. Raising Maturity to 70 would lift the score to about 61.

Thirty pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Thirteen places in the code run text as code, which an attacker could use, and eight secrets can leak from the build pipeline. Pinning each tool to an exact version, replacing text run as code with direct calls and limiting each secret to its own step would close these risks. The four pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The two parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.

The product code is 33,693 lines, about €40,000 to rebuild.

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

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Maturity 49 · counts for 47%Production Readiness 50 · counts for 26%Code Health 68 · counts for 14%Security and Compliance 75 · counts for 8%Architecture 89 · counts for 4%

If Maturity rose from 49 to 70, the lowest score rated Strong, the score would rise from 56 to about 61.

Code composition: what the lines of code are
Product code 84%Tests 16%
New since the last survey: 3 findings

These 3 critical or serious findings weren't in the previous survey, on 17 October 2026.

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

Fixed since the last survey: 2 findings

These 2 critical or serious findings were in the previous survey, on 17 October 2026, and are gone from this one.

  • Supply-chain Provenance & Signing REDACTED
  • Supply-chain Provenance & Signing REDACTED
Rebuild cost: about €40,000 · Estimate
Cost to rebuild€13,000 to €67,000, for 223 to 707 hours of work, about 0.3 person-years for one engineer
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 56. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeMedium: 33,693 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Record your significant design decisions.
Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Raises the score by about 7 points · Medium effort · Architecture documentation
2
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 5 points · Medium effort · Security & performance tooling
3
Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with bench.py, Parsing.py.
Raises the score by about 2 points · Low effort · Knowledge Freshness

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €40,000 to build again, about 0.3 person-years of work. Its weakest lens is Maturity, at 49 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Record your significant design decisions. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 4.9 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 8% to 18% on every change. The history of the code shows how much it changes: about 68 lines over the last 90 days, which is about 276 lines a year. At that pace, the extra work comes to an estimated 0.1 to 0.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

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

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

At a glance — Maturity · 49% · Weak · gated by M2 ·

At a glance — Readiness · 50% · Adequate · gated by P3 ·

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

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection69High / Critical
A03:2025 — Software Supply Chain Failures6Medium

Roadmap

Top priorities: Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them; Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing; Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.

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

Do thisHelpsEffortDimension
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+6.7 ptsMediumArchitecture documentation
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.+5.0 ptsMediumSecurity & performance tooling
Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with bench.py, Parsing.py.+2.0 ptsLowKnowledge Freshness
Resolve the 1 Off-boarding risk finding(s) in Bus Factor.+1.2 ptsLowBus Factor
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.+2.2 ptsMediumDocumentation (README)
Resolve the 4 Orphaned file finding(s) in Knowledge Freshness — start with LinearSystem.py, gen_lim_fs_extrap.py, Numerics.py.+1.0 ptsLowKnowledge Freshness
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where Watchdog can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.+1.7 ptsMediumDeployment & Rollback
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+1.7 ptsMediumRelease Hygiene

File quality

Per-file score 0–10 — a quality signature. Of 42 files carrying findings, judged against the Production bar: 21% slop · 74% mixed · 5% near-clean.

FileScoreBandWorst signal
REDACTED0.6SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
moments/Plotting.py6.0MixedExplicit Debt: XxxComment
moments/LD/Godambe.py6.0MixedExplicit Debt: TodoComment
REDACTED6.1MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED6.9MixedStatic Analysis (SAST): Medium: REDACTED
moments/LD/Matrices.py7.0MixedCyclomatic Complexity: Matrices.admix_ld (cyclomatic 216)
moments/Demes/Demes.py7.0MixedCyclomatic Complexity: Demes.SFS (cyclomatic 82)
moments/LD/Parsing.py7.0MixedCyclomatic Complexity: Parsing._count_types_sparse (cyclomatic 43)
moments/Misc.py7.0MixedCyclomatic Complexity: Misc.make_data_dict_vcf (cyclomatic 37)
moments/Demes/Inference.py7.0MixedCyclomatic Complexity: Inference._set_value (cyclomatic 24)
moments/LD/stats_from_genotype_counts.py7.0MixedCyclomatic Complexity: stats_from_genotype_counts.pi2 (cyclomatic 24)

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

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

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

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

Could not be resolved — 32

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. 39 of 39 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. 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 — 39 dimensions across the health lenses
D1D2D3D4D6D9D11D13D14D15D16D17D19D26D27D28D29D30D34D35D36D43D44AX10AX3AX4M1M2M3P1P10P2P3P4P6X20X23X27X28

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, 608 of 619 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 measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a19150-e854-7d32-8cde-06c339f7dc4c.

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, .fs) 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 Cobertura — `dotnet test --collect:"XPlat Code Coverage"` with a `coverlet.collector` PackageReference) 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 Cobertura — `dotnet test --collect:"XPlat Code Coverage"` with a `coverlet.collector` PackageReference) 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.
  • D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 11 shipped Python distribution(s) across 2 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
  • D19 Documentation Quality — 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. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — 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 kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — 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. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — 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. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — 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's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • AX2 Stateful singletons — 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 Microsoft.Extensions.DependencyInjection singletons in C#, Spring/JSR-330/CDI singletons in Java and Kotlin, module state in Python request handlers, handler state in Go and Swift, Play controllers, Cask routes, Scalatra servlets, Finatra controllers, Akka/Pekko HTTP routes and JSR-330 singletons in Scala, Rails, Sinatra, Grape, Roda and Hanami handlers and Rack apps in Ruby, and module state in F# request handlers (Giraffe, Saturn, Falco, Oxpecker and Suave handlers and ASP.NET Core controllers) only, and this repository's product is written in F#, which was left unread, 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.
  • 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.
  • 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 reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — 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.
  • 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.
  • 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.
  • 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.
  • 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 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.
  • 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.
  • X32 Type resolved by simple name across every loaded assembly — 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.
  • 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.
  • D11 Test Reliability: Flakiness is inferred from history/markers — Watchdog runs the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned 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.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

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

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

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

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

58 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Matrices.admix_ld at 216.

Matrices.admix_ld (cyclomatic 216)moments/LD/Matrices.py:995
Matrices.migration_ld (cyclomatic 103)moments/LD/Matrices.py:415
Demes.SFS (cyclomatic 82)moments/Demes/Demes.py:17
Parsing._tally_vcf (cyclomatic 72)moments/Parsing.py:317
Parsing._count_types_sparse (cyclomatic 43)moments/LD/Parsing.py:549

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

What to do

  1. Bring the 4 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Matrices.admix_ld (cyclomatic 216), Matrices.migration_ld (cyclomatic 103), Demes.SFS (cyclomatic 82). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 4 together lifts Cyclomatic Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

106 method(s) exceeded the cognitive complexity threshold of 15; the worst was Matrices.migration_ld at 358.

Matrices.migration_ld (cognitive 358)moments/LD/Matrices.py:415
Parsing._tally_vcf (cognitive 158)moments/Parsing.py:317
Demes.SFS (cognitive 152)moments/Demes/Demes.py:17
Matrices.admix_ld (cognitive 134)moments/LD/Matrices.py:995
Demes._get_deme_sample_sizes (cognitive 123)moments/Demes/Demes.py:1023

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

What to do

  1. Bring the 46 bodies over 30 down to 30 or less in Cognitive Complexity — start with Matrices.migration_ld (cognitive 358), Parsing._tally_vcf (cognitive 158), Demes.SFS (cognitive 152). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 46 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

16 god class(es) detected.

FileTooLong: LD/Matrices.py · ×15moments/LD/Matrices.py
TooManyMethods: SpectrumREDACTED:35

What to do

  1. Resolve the 15 FileTooLong finding(s) in God Classes — start with Inference.py (3), Parsing.py (2), Matrices.py. — One of this dimension's main actionable groups (15 warning-level).
  2. Resolve the 1 TooManyMethods finding(s) in God Classes — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  3. 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 Duplication5.5 / 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 5.5 / 10 · rule-coverage 100% · ceiling Verified

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

Duplicated block (5 lines × 2) · ×19moments/Demes/Inference.py:405
Duplicated block (10 lines × 2) · ×15moments/Demes/Demes.py:951
Duplicated block (6 lines × 2) · ×14REDACTED:793
Duplicated block (9 lines × 2) · ×13moments/Demes/Demes.py:1322
Duplicated block (7 lines × 2) · ×13moments/Demes/Demes.py:162

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

What to do

  1. Resolve the 19 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with stats_from_genotype_counts.py (8), Numerics.py (3), REDACTED (2). — One of this dimension's main actionable groups (19 warning-level).
  2. Resolve the 15 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with stats_from_genotype_counts.py (4), Numerics.py (3), Demes.py. — One of this dimension's main actionable groups (15 warning-level).
  3. Resolve the 14 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with stats_from_genotype_counts.py (3), Matrices.py (2), REDACTED (2). — One of this dimension's main actionable groups (14 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.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 1 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.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

298 test methods: 298 unit, 0 integration, 0 BDD, 0 e2e. The Python suite contributes 298 test function(s) across 19 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.

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

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

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

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

0 flaky across 1 measured tier(s). Python (repository root, 19 test files): measured (0 flaky).

✓ On the Gold path — maintain.

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

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots10.0 / 10Exemplary✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

No churn × complexity hotspots in the window.

✓ On the Gold path — maintain.

Detailed fixes: d15_recommendation.md.

D16 · Bus Factor8.9 / 10Strong✓ Tool-verified

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

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

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

4 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is moments/Demes/Demes.py. Counted over 37 of the 55 production source files in this repository: 10 are under the ~2,400-byte size floor this dimension measures over, and the remaining 8 have no attributable history left to measure.

Off-boarding risk: anonymized user #1

What to do

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

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

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

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

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

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

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

XxxComment · ×2moments/Plotting.py:939
TodoComment · ×2REDACTED:540

What to do

  1. Resolve the 2 XxxComment finding(s) in Explicit Debt — start with Plotting.py, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 2 TodoComment finding(s) in Explicit Debt — start with REDACTED, Godambe.py. — One of this dimension's main actionable groups (2 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 Quality10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

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

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

1 of 1 build units (Python) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)0.1 / 10Critical✓ Tool-verified

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

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

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

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

69 finding(s): 0 critical, 55 high, 14 medium, 0 low. 30 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
REDACTED

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

What to do

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

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

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

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

6 of 45 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is bench/bench.py. Counted over 45 of the 55 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×2bench/bench.py:1
Orphaned file · ×4moments/LinearSystem.py:1
Further orphaned files (smaller)

What to do

  1. Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with bench.py, Parsing.py. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 4 Orphaned file finding(s) in Knowledge Freshness — start with LinearSystem.py, gen_lim_fs_extrap.py, Numerics.py. — One of this dimension's main actionable groups (4 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.8 / 10Stronggated by 1 serious finding✓ Tool-verified

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

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

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

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

Strongest change-coupling: REDACTED↔REDACTED 55%

Change coupling: REDACTED ↔ REDACTEDREDACTED:1

What to do

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

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

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ 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 5.0 / 10 · rule-coverage 100% · ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-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 1 platform declaration(s) and 11 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 composition10.0 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

M1 · Documentation (README)6.7 / 10Adequate✓ 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

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
M2 · Architecture documentation0.0 / 10Critical✓ Tool-verified

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

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

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
  • No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
  • Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

P2 · 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 tooling0.0 / 10Critical✓ Tool-verified

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

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

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

What to do

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

What to do

  • Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where Watchdog can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
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.
X20 · Mistyped argument guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.

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

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

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

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

Other · Code Health — Whether a `for … in` loop leaves the mutable .NET collection it is walking alone — F#'s own lists, arrays, maps and sets cannot be changed by a loop body, but a `ResizeArray`, `Dictionary`, `Queue` or other BCL collection walked by `for x in c do` is walked through its enumerator, so a body that adds to or removes from `c` makes the next `MoveNext` throw `InvalidOperationException` and the remaining items are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

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

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

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

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

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 Health68%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture89%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity49%Weak — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness50%Adequate — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security75%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Unscored — 1 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 6 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

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

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 79 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 F# 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; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — 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
  • 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
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • 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.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository registers no route and starts no server another machine can reach (no Flask/FastAPI/Starlette route, Django urlpatterns or class-based view, Tornado handler). Access control is therefore N/A here — a library or command-line tool is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D10 Test Quality — ~6192 lines of test source are present (.py, .fs) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
  • 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.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; Python not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .fs, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • 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.
  • D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — not scored — this repository shows none of the 3 signals this lens looks for
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • M4 Documentation accuracy — Not applicable: the 21 current-state document(s) make no claim of a kind M4 checks. 1 claim(s) of kinds M4 does not check were not checked (environment variable 1); M4 checks only links and versions and artefact counts.
  • 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 measured — the application kind could not be determined for this repo
  • 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 (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, 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 a BenchmarkDotNet reference in an .fsproj or .vbproj, 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: allocation awareness is rated where code engineers for it — at least 400 production lines that ship benchmarks or already use allocation-aware idioms (8 or more). This repository's F# code has 12 production line(s), 0 such use(s) and no benchmarks, so there is no allocation work to rate. The card is reward-only: its absence costs nothing.
  • PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
  • 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
  • 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
  • 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.
  • 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.
  • X29 Per-element action decided by a fixed element — 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.
  • 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 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.
  • 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 — 57 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
  • + 5 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×2
  • Orphaned knowledge bench/bench.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge moments/Parsing.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Serious — 541 finding(s)
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×19
  • Duplicated block (5 lines × 2) moments/Demes/Inference.py:405 — moments/Demes/Inference.py:405-409 | moments/Demes/Inference.py:1004-1008 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) REDACTED:206 — REDACTED:206-210 | REDACTED:251-255 — both copies are in the same file, so extract the 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) moments/LD/Matrices.py:546 — moments/LD/Matrices.py:546-550 | moments/LD/Matrices.py:570-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 (5 lines × 2) moments/LD/stats_from_genotype_counts.py:667 — moments/LD/stats_from_genotype_counts.py:667-671 | moments/LD/stats_from_genotype_counts.py:1357-1361 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:667` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:687 — moments/LD/stats_from_genotype_counts.py:687-691 | moments/LD/stats_from_genotype_counts.py:1112-1116 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:687` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:850 — moments/LD/stats_from_genotype_counts.py:850-854 | moments/LD/stats_from_genotype_counts.py:1288-1292 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:850` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:870 — moments/LD/stats_from_genotype_counts.py:870-874 | moments/LD/stats_from_genotype_counts.py:1176-1180 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:870` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:1057 — moments/LD/stats_from_genotype_counts.py:1057-1061 | moments/LD/stats_from_genotype_counts.py:1247-1251 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1057` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:1070 — moments/LD/stats_from_genotype_counts.py:1070-1074 | moments/LD/stats_from_genotype_counts.py:1344-1348 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1070` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:1125 — moments/LD/stats_from_genotype_counts.py:1125-1129 | moments/LD/stats_from_genotype_counts.py:1370-1374 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/LD/stats_from_genotype_counts.py:1247 — moments/LD/stats_from_genotype_counts.py:1247-1251 | moments/LD/stats_from_genotype_counts.py:1412-1416 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/Triallele/Jackknife.py:61 — moments/Triallele/Jackknife.py:61-65 | moments/Triallele/Jackknife.py:121-125 — both copies are in the same file, so extract the 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) moments/TwoLocus/Numerics.py:94 — moments/TwoLocus/Numerics.py:94-98 | moments/TwoLocus/Numerics.py:111-115 — both copies are in the same file, so extract the 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) moments/TwoLocus/Numerics.py:1194 — moments/TwoLocus/Numerics.py:1194-1198 | moments/TwoLocus/Numerics.py:1215-1219 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:1194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) moments/TwoLocus/Util.py:340 — moments/TwoLocus/Util.py:340-344 | moments/TwoLocus/Util.py:391-395 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Util.py:340` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) REDACTED:73 — REDACTED:73-77 | REDACTED:115-119 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) REDACTED:185 — REDACTED:185-189 | REDACTED:122-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) REDACTED:694 — REDACTED:694-698 | REDACTED:702-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) moments/TwoLocus/Numerics.py:408 — moments/TwoLocus/Numerics.py:408-412 | moments/TwoLocus/Numerics.py:418-422 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D3 · God Classes · FileTooLong · ×15
  • FileTooLong: LD/Matrices.py moments/LD/Matrices.py — FileTooLong — 3653 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3153 over it, 7.31× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: LD/stats_from_genotype_counts.py moments/LD/stats_from_genotype_counts.py — FileTooLong — 1279 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 779 over it, 2.56× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1147 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 647 over it, 2.29× 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: Demes/Demes.py moments/Demes/Demes.py — FileTooLong — 1085 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 585 over it, 2.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: LD/Parsing.py moments/LD/Parsing.py — FileTooLong — 1024 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 524 over it, 2.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Demes/Inference.py moments/Demes/Inference.py — FileTooLong — 928 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 428 over it, 1.86× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 896 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 396 over it, 1.79× 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: TwoLocus/Numerics.py moments/TwoLocus/Numerics.py — FileTooLong — 879 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 379 over it, 1.76× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: moments/Plotting.py moments/Plotting.py — FileTooLong — 754 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 254 over it, 1.51× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 244 over it, 1.49× 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: moments/Inference.py moments/Inference.py — FileTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 114 over it, 1.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: moments/Parsing.py moments/Parsing.py — FileTooLong — 611 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 111 over it, 1.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 584 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 84 over it, 1.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: LD/Inference.py moments/LD/Inference.py — FileTooLong — 562 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 62 over it, 1.12× 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: moments/Manips.py moments/Manips.py — FileTooLong — 506 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6 over it, 1.01× 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 (10 lines × 2) · ×15
  • Duplicated block (10 lines × 2) moments/Demes/Demes.py:951 — moments/Demes/Demes.py:951-960 | moments/Demes/Demes.py:964-973 — both copies are in the same file, so extract the 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 `moments/Demes/Demes.py:951` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) moments/Demes/Inference.py:356 — moments/Demes/Inference.py:356-365 | moments/Demes/Inference.py:949-958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) moments/Godambe.py:208 — moments/Godambe.py:208-217 | moments/LD/Godambe.py:252-261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) REDACTED:1152 — REDACTED:1152-1161 | REDACTED:615-624 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) REDACTED:218 — REDACTED:218-227 | REDACTED:266-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) moments/LD/Matrices.py:675 — moments/LD/Matrices.py:675-684 | moments/LD/Matrices.py:756-765 — both copies are in the same file, so extract the 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) moments/LD/stats_from_genotype_counts.py:167 — moments/LD/stats_from_genotype_counts.py:167-176 | moments/LD/stats_from_genotype_counts.py:417-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) moments/LD/stats_from_genotype_counts.py:524 — moments/LD/stats_from_genotype_counts.py:524-533 | moments/LD/stats_from_genotype_counts.py:550-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 (10 lines × 2) moments/LD/stats_from_genotype_counts.py:586 — moments/LD/stats_from_genotype_counts.py:586-595 | moments/LD/stats_from_genotype_counts.py:626-635 — both copies are in the same file, so extract the 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) moments/LD/stats_from_genotype_counts.py:951 — moments/LD/stats_from_genotype_counts.py:951-960 | moments/LD/stats_from_genotype_counts.py:1197-1206 — both copies are in the same file, so extract the 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) moments/Misc.py:569 — moments/Misc.py:569-578 | moments/Misc.py:580-589 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) moments/Triallele/Numerics.py:346 — moments/Triallele/Numerics.py:346-355 | moments/Triallele/Numerics.py:448-457 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) moments/Triallele/Numerics.py:434 — moments/Triallele/Numerics.py:434-443 | moments/Triallele/Numerics.py:480-489 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:434` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) moments/TwoLocus/Numerics.py:538 — moments/TwoLocus/Numerics.py:538-547 | moments/TwoLocus/Numerics.py:576-585 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) REDACTED:160 — REDACTED:160-169 | REDACTED:172-181 — both copies are in the same file, so extract the 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 (6 lines × 2) · ×14
  • Duplicated block (6 lines × 2) REDACTED:793 — REDACTED:793-798 | REDACTED:804-809 — both copies are in the same file, so extract the 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) REDACTED:625 — REDACTED:625-630 | REDACTED:795-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) moments/LD/Godambe.py:41 — moments/LD/Godambe.py:41-46 | moments/LD/Godambe.py:177-182 — both copies are in the same file, so extract the 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) moments/LD/Matrices.py:86 — moments/LD/Matrices.py:86-91 | moments/LD/Matrices.py:185-192 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) moments/LD/Matrices.py:524 — moments/LD/Matrices.py:524-529 | moments/LD/Matrices.py:548-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. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:524` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) moments/LD/stats_from_genotype_counts.py:365 — moments/LD/stats_from_genotype_counts.py:365-370 | moments/LD/stats_from_genotype_counts.py:412-417 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) moments/LD/stats_from_genotype_counts.py:661 — moments/LD/stats_from_genotype_counts.py:661-666 | moments/LD/stats_from_genotype_counts.py:1351-1356 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:661` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) moments/LD/stats_from_genotype_counts.py:1071 — moments/LD/stats_from_genotype_counts.py:1071-1076 | moments/LD/stats_from_genotype_counts.py:1413-1418 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1071` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) moments/Triallele/Jackknife.py:52 — moments/Triallele/Jackknife.py:52-57 | moments/Triallele/Jackknife.py:112-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) REDACTED:275 — REDACTED:275-280 | REDACTED:285-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) moments/TwoLocus/Numerics.py:893 — moments/TwoLocus/Numerics.py:893-898 | moments/TwoLocus/Numerics.py:1176-1181 — both copies are in the same file, so extract the 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) moments/TwoLocus/Numerics.py:1187 — moments/TwoLocus/Numerics.py:1187-1192 | moments/TwoLocus/Numerics.py:1208-1213 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:1187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) moments/LD/Parsing.py:1363 — moments/LD/Parsing.py:1363-1368 | moments/LD/Parsing.py:1481-1486 — both copies are in the same file, so extract the 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) moments/LD/stats_from_haplotype_counts.py:163 — moments/LD/stats_from_haplotype_counts.py:163-168 | moments/LD/stats_from_haplotype_counts.py:315-320 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_haplotype_counts.py:163` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/LD/stats_from_haplotype_counts.py:313` calls `sum` and `moments/LD/stats_from_haplotype_counts.py:162` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×13
  • Duplicated block (9 lines × 2) moments/Demes/Demes.py:1322 — moments/Demes/Demes.py:1322-1330 | moments/Demes/Demes.py:1603-1611 — both copies are in the same file, so extract the 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) moments/Demes/Demes.py:1392 — moments/Demes/Demes.py:1392-1400 | moments/Demes/Demes.py:1648-1656 — both copies are in the same file, so extract the 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) moments/Godambe.py:101 — moments/Godambe.py:101-109 | moments/LD/Godambe.py:129-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) moments/LD/Matrices.py:518 — moments/LD/Matrices.py:518-526 | moments/LD/Matrices.py:690-698 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:518` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) moments/LD/stats_from_genotype_counts.py:323 — moments/LD/stats_from_genotype_counts.py:323-331 | moments/LD/stats_from_genotype_counts.py:370-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) moments/LD/stats_from_genotype_counts.py:555 — moments/LD/stats_from_genotype_counts.py:555-563 | moments/LD/stats_from_genotype_counts.py:594-602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) moments/Manips.py:318 — moments/Manips.py:318-326 | moments/Manips.py:380-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Manips.py:318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) moments/Misc.py:392 — moments/Misc.py:392-400 | REDACTED:1687-1697 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) moments/Plotting.py:689 — moments/Plotting.py:689-697 | moments/Plotting.py:1052-1060 — both copies are in the same file, so extract the 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) moments/Triallele/Jackknife.py:187 — moments/Triallele/Jackknife.py:187-195 | moments/Triallele/Jackknife.py:205-213 — both copies are in the same file, so extract the 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) moments/Triallele/Numerics.py:370 — moments/Triallele/Numerics.py:370-378 | moments/Triallele/Numerics.py:408-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. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:370` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) moments/TwoLocus/Numerics.py:609 — moments/TwoLocus/Numerics.py:609-617 | moments/TwoLocus/Numerics.py:647-655 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:609` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) moments/TwoLocus/Numerics.py:657 — moments/TwoLocus/Numerics.py:657-665 | moments/TwoLocus/Numerics.py:716-724 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:657` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×13
  • Duplicated block (7 lines × 2) moments/Demes/Demes.py:162 — moments/Demes/Demes.py:162-168 | moments/Demes/Demes.py:442-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Demes/Demes.py:160` calls `ValueError` and `moments/Demes/Demes.py:440` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) moments/Godambe.py:28 — moments/Godambe.py:28-34 | moments/LD/Godambe.py:42-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) REDACTED:33 — REDACTED:33-39 | REDACTED:37-43 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) moments/LD/Matrices.py:952 — moments/LD/Matrices.py:952-958 | moments/LD/Matrices.py:996-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/LD/Matrices.py:1003` calls `split` and `moments/LD/Matrices.py:959` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) moments/LD/stats_from_genotype_counts.py:1118 — moments/LD/stats_from_genotype_counts.py:1118-1124 | moments/LD/stats_from_genotype_counts.py:1363-1369 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/LD/stats_from_genotype_counts.py:1253 — moments/LD/stats_from_genotype_counts.py:1253-1259 | moments/LD/stats_from_genotype_counts.py:1419-1425 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1253` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/Manips.py:123 — moments/Manips.py:123-129 | moments/Manips.py:181-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Manips.py:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/Manips.py:308 — moments/Manips.py:308-314 | moments/Manips.py:370-376 — both copies are in the same file, so extract the 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 `moments/Manips.py:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/Plotting.py:1068 — moments/Plotting.py:1068-1074 | moments/Plotting.py:1079-1085 — both copies are in the same file, so extract the 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 `moments/Plotting.py:1068` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/Triallele/Jackknife.py:22 — moments/Triallele/Jackknife.py:22-28 | moments/Triallele/Jackknife.py:82-88 — both copies are in the same file, so extract the 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 `moments/Triallele/Jackknife.py:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/Triallele/Numerics.py:338 — moments/Triallele/Numerics.py:338-344 | moments/Triallele/Numerics.py:440-446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) moments/TwoLocus/Util.py:345 — moments/TwoLocus/Util.py:345-351 | moments/TwoLocus/Util.py:396-402 — both copies are in the same file, so extract the 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) moments/LD/Parsing.py:433 — moments/LD/Parsing.py:433-439 | moments/LD/Parsing.py:524-530 — both copies are in the same file, so extract the 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 `moments/LD/Parsing.py:433` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/LD/Parsing.py:523` calls `compute_D` and `moments/LD/Parsing.py:432` 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 (13 lines × 2) · ×12
  • Duplicated block (13 lines × 2) moments/Demes/Inference.py:84 — moments/Demes/Inference.py:84-96 | moments/Demes/Inference.py:151-163 — both copies are in the same file, so extract the 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) moments/Inference.py:687 — moments/Inference.py:687-699 | moments/TwoLocus/Inference.py:249-262 — before extracting anything, compare `moments/Inference.py` and `moments/TwoLocus/Inference.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Inference.py:687` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) moments/LD/Godambe.py:383 — moments/LD/Godambe.py:383-395 | moments/LD/Godambe.py:485-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/LD/Godambe.py:382` calls `deepcopy` and `moments/LD/Godambe.py:483` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) moments/LD/Plotting.py:94 — moments/LD/Plotting.py:94-106 | moments/LD/Plotting.py:256-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) moments/LD/stats_from_genotype_counts.py:542 — moments/LD/stats_from_genotype_counts.py:542-554 | moments/LD/stats_from_genotype_counts.py:573-585 — both copies are in the same file, so extract the 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) moments/LD/stats_from_haplotype_counts.py:215 — moments/LD/stats_from_haplotype_counts.py:215-227 | moments/LD/stats_from_haplotype_counts.py:232-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/LD/stats_from_haplotype_counts.py:246` calls `elif` and `moments/LD/stats_from_haplotype_counts.py:229` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) moments/Manips.py:398 — moments/Manips.py:398-410 | moments/Manips.py:414-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13 lines × 2) moments/Manips.py:430 — moments/Manips.py:430-442 | moments/Manips.py:446-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13 lines × 2) moments/Reversible.py:98 — moments/Reversible.py:98-110 | moments/Reversible.py:168-180 — both copies are in the same file, so extract the 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) moments/Triallele/Numerics.py:77 — moments/Triallele/Numerics.py:77-89 | moments/Triallele/Numerics.py:100-112 — both copies are in the same file, so extract the 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) moments/Triallele/Numerics.py:551 — moments/Triallele/Numerics.py:551-563 | moments/Triallele/Numerics.py:579-591 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:551` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) moments/TwoLocus/Numerics.py:1110 — moments/TwoLocus/Numerics.py:1110-1122 | moments/TwoLocus/Numerics.py:1124-1136 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D29 · Static Analysis (SAST) · REDACTED · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×8
  • Duplicated block (8 lines × 2) moments/Godambe.py:36 — moments/Godambe.py:36-43 | moments/LD/Godambe.py:50-57 — 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) moments/Godambe.py:129 — moments/Godambe.py:129-136 | moments/LD/Godambe.py:168-175 — 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) moments/Inference.py:75 — moments/Inference.py:75-82 | moments/TwoLocus/Inference.py:183-190 — before extracting anything, compare `moments/Inference.py` and `moments/TwoLocus/Inference.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) moments/LD/stats_from_genotype_counts.py:344 — moments/LD/stats_from_genotype_counts.py:344-351 | moments/LD/stats_from_genotype_counts.py:391-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. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:344` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) moments/LD/stats_from_genotype_counts.py:646 — moments/LD/stats_from_genotype_counts.py:646-653 | moments/LD/stats_from_genotype_counts.py:829-836 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) moments/Triallele/Numerics.py:444 — moments/Triallele/Numerics.py:444-451 | moments/Triallele/Numerics.py:508-515 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:444` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) moments/Triallele/Numerics.py:470 — moments/Triallele/Numerics.py:470-477 | moments/Triallele/Numerics.py:489-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:470` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) moments/Triallele/Numerics.py:507 — moments/Triallele/Numerics.py:507-514 | moments/Triallele/Numerics.py:526-533 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:507` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×7
  • Duplicated block (12 lines × 2) moments/Demes/Demes.py:1055 — moments/Demes/Demes.py:1055-1066 | moments/Demes/Demes.py:1121-1132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) moments/Demes/Inference.py:509 — moments/Demes/Inference.py:509-520 | moments/Demes/Inference.py:1097-1108 — both copies are in the same file, so extract the 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 `moments/Demes/Inference.py:509` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) REDACTED:1107 — REDACTED:1107-1118 | REDACTED:583-594 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) moments/Triallele/Numerics.py:397 — moments/Triallele/Numerics.py:397-408 | moments/Triallele/Numerics.py:499-510 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:397` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Triallele/Numerics.py:396` calls `choose` and `moments/Triallele/Numerics.py:498` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) REDACTED:1029 — REDACTED:1029-1040 | REDACTED:1044-1055 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1029` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) moments/TwoLocus/Numerics.py:635 — moments/TwoLocus/Numerics.py:635-646 | moments/TwoLocus/Numerics.py:716-727 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:635` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) moments/TwoLocus/Numerics.py:728 — moments/TwoLocus/Numerics.py:728-739 | moments/TwoLocus/Numerics.py:749-760 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Numerics.py:728` 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (4 members, 50+ identical tokens) moments/Demes/Inference.py:356 — moments/Demes/Inference.py:356-409 | moments/Demes/Inference.py:689-889 | moments/Demes/Inference.py:949-1008 | moments/Demes/Inference.py:1276-1427 — 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) moments/Inference.py:114 — moments/Inference.py:114-216 | moments/Inference.py:723-829 | moments/Inference.py:955-1046 | moments/TwoLocus/Inference.py:222-262 — 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) moments/TwoLocus/Demographics.py:111 — moments/TwoLocus/Demographics.py:111-139 | moments/TwoLocus/Demographics.py:143-173 | moments/TwoLocus/Demographics.py:177-207 | moments/TwoLocus/Demographics.py:211-241 — 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) moments/TwoLocus/Util.py:126 — moments/TwoLocus/Util.py:126-156 | moments/TwoLocus/Util.py:160-219 | moments/TwoLocus/Util.py:223-318 | moments/TwoLocus/Util.py:322-433 — 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) moments/TwoLocus/Util.py:504 — moments/TwoLocus/Util.py:504-521 | moments/TwoLocus/Util.py:527-544 | moments/TwoLocus/Util.py:550-567 | moments/TwoLocus/Util.py:573-590 — 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 (15 lines × 2) · ×5
  • Duplicated block (15 lines × 2) moments/Demes/Demes.py:1109 — moments/Demes/Demes.py:1109-1123 | moments/Demes/Demes.py:1124-1138 — both copies are in the same file, so extract the 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 `moments/Demes/Demes.py:1109` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) REDACTED:1010 — REDACTED:1010-1024 | REDACTED:510-524 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) moments/LD/Inference.py:322 — moments/LD/Inference.py:322-336 | moments/TwoLocus/Inference.py:144-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) moments/LD/Matrices.py:1128 — moments/LD/Matrices.py:1128-1142 | moments/LD/Matrices.py:2521-2535 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:1128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) moments/TwoLocus/Util.py:259 — moments/TwoLocus/Util.py:259-273 | moments/TwoLocus/Util.py:302-316 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Util.py:259` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×5
  • Duplicated block (14 lines × 2) moments/Demes/Inference.py:65 — moments/Demes/Inference.py:65-78 | moments/Demes/Inference.py:134-147 — both copies are in the same file, so extract the 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) moments/LD/Matrices.py:1032 — moments/LD/Matrices.py:1032-1045 | moments/LD/Matrices.py:1056-1069 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:1032` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) moments/LD/stats_from_genotype_counts.py:491 — moments/LD/stats_from_genotype_counts.py:491-504 | moments/LD/stats_from_genotype_counts.py:559-572 — both copies are in the same file, so extract the 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) moments/Manips.py:224 — moments/Manips.py:224-237 | moments/Manips.py:287-300 — both copies are in the same file, so extract the 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) REDACTED:1552 — REDACTED:1552-1565 | REDACTED:374-387 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1550` calls `write` and `REDACTED:372` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) moments/LD/Matrices.py:646 — moments/LD/Matrices.py:646-653 | moments/LD/Matrices.py:666-673 | moments/LD/Matrices.py:727-734 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:646` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) moments/LD/Parsing.py:863 — moments/LD/Parsing.py:863-870 | moments/LD/Parsing.py:887-894 | moments/LD/Parsing.py:910-917 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Parsing.py:863` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) moments/Triallele/Numerics.py:369 — moments/Triallele/Numerics.py:369-376 | moments/Triallele/Numerics.py:388-395 | moments/Triallele/Numerics.py:407-414 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:369` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/Triallele/Numerics.py:396` calls `choose` and `moments/Triallele/Numerics.py:415` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) moments/Triallele/Numerics.py:429 — moments/Triallele/Numerics.py:429-436 | moments/Triallele/Numerics.py:522-529 | moments/Triallele/Numerics.py:570-577 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:429` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) moments/Triallele/Numerics.py:466 — moments/Triallele/Numerics.py:466-473 | moments/Triallele/Numerics.py:551-558 | moments/Triallele/Numerics.py:579-586 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:466` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×5
  • Duplicated block (5 lines × 3) moments/LD/Matrices.py:503 — moments/LD/Matrices.py:503-507 | moments/LD/Matrices.py:525-529 | moments/LD/Matrices.py:549-553 — 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 (5 lines × 3) moments/LD/Parsing.py:880 — moments/LD/Parsing.py:880-884 | moments/LD/Parsing.py:904-908 | moments/LD/Parsing.py:935-939 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Parsing.py:880` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) moments/LD/stats_from_genotype_counts.py:662 — moments/LD/stats_from_genotype_counts.py:662-666 | moments/LD/stats_from_genotype_counts.py:1090-1094 | moments/LD/stats_from_genotype_counts.py:1352-1356 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:662` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) moments/LinearSystem.py:112 — moments/LinearSystem.py:112-116 | moments/LinearSystem.py:186-190 | moments/LinearSystem.py:273-277 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) REDACTED:87 — REDACTED:87-91 | REDACTED:192-196 | REDACTED:129-133 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×4
  • Duplicated block (11 lines × 2) moments/LD/stats_from_genotype_counts.py:581 — moments/LD/stats_from_genotype_counts.py:581-591 | moments/LD/stats_from_genotype_counts.py:611-621 — both copies are in the same file, so extract the 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) moments/Manips.py:800 — moments/Manips.py:800-810 | moments/Manips.py:935-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) moments/Misc.py:831 — moments/Misc.py:831-841 | REDACTED:1703-1713 — 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) moments/TwoLocus/Numerics.py:526 — moments/TwoLocus/Numerics.py:526-536 | moments/TwoLocus/Numerics.py: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.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×4
  • Duplicated block (7 lines × 3) moments/LD/Godambe.py:411 — moments/LD/Godambe.py:411-417 | moments/LD/Godambe.py:508-514 | moments/LD/Godambe.py:582-588 — 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 (7 lines × 3) moments/Triallele/Numerics.py:338 — moments/Triallele/Numerics.py:338-344 | moments/Triallele/Numerics.py:372-378 | moments/Triallele/Numerics.py:512-518 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) moments/Triallele/Numerics.py:445 — moments/Triallele/Numerics.py:445-451 | moments/Triallele/Numerics.py:491-497 | moments/Triallele/Numerics.py:509-515 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) moments/Triallele/Numerics.py:444 — moments/Triallele/Numerics.py:444-450 | moments/Triallele/Numerics.py:508-514 | moments/Triallele/Numerics.py:527-533 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:444` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Triallele/Numerics.py:526` calls `choose` and `moments/Triallele/Numerics.py:443` 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 (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) moments/LD/Matrices.py:696 — moments/LD/Matrices.py:696-701 | moments/LD/Matrices.py:783-788 | moments/LD/Matrices.py:810-815 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:696` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) moments/LD/stats_from_genotype_counts.py:154 — moments/LD/stats_from_genotype_counts.py:154-159 | moments/LD/stats_from_genotype_counts.py:344-351 | moments/LD/stats_from_genotype_counts.py:391-398 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) moments/LD/stats_from_genotype_counts.py:349 — moments/LD/stats_from_genotype_counts.py:349-354 | moments/LD/stats_from_genotype_counts.py:359-364 | moments/LD/stats_from_genotype_counts.py:431-436 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:349` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 3) moments/LD/stats_from_genotype_counts.py:396 — moments/LD/stats_from_genotype_counts.py:396-401 | moments/LD/stats_from_genotype_counts.py:406-411 | moments/LD/stats_from_genotype_counts.py:456-461 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:396` 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 · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED:599 — REDACTED:599-669 | moments/Numerics.py:139-183 | REDACTED:1416-1492 | REDACTED:185-247 | REDACTED:291-339 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) moments/Manips.py:85 — moments/Manips.py:85-139 | moments/Manips.py:143-197 | moments/Manips.py:201-260 | moments/Manips.py:264-326 | moments/Manips.py:330-388 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED:210 — REDACTED:210-218 | REDACTED:221-235 | REDACTED:238-252 | REDACTED:255-269 | REDACTED:272-286 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) moments/LD/Util.py:123 — moments/LD/Util.py:123-147 | moments/Misc.py:125-149 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (25 lines × 2) moments/Manips.py:264 — moments/Manips.py:264-292 | moments/Manips.py:330-354 — both copies are in the same file, so extract the 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 (25 lines × 2) moments/TwoLocus/Demographics.py:111 — moments/TwoLocus/Demographics.py:111-135 | moments/TwoLocus/Demographics.py:177-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/TwoLocus/Demographics.py:205` calls `exp`, `log` and `moments/TwoLocus/Demographics.py:138` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×3
  • Duplicated block (18 lines × 2) moments/Inference.py:1213 — moments/Inference.py:1213-1230 | moments/TwoLocus/Inference.py:89-106 — before extracting anything, compare `moments/Inference.py` and `moments/TwoLocus/Inference.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) moments/LD/Matrices.py:1719 — moments/LD/Matrices.py:1719-1736 | moments/LD/Matrices.py:2689-2706 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:1719` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) moments/LD/stats_from_genotype_counts.py:511 — moments/LD/stats_from_genotype_counts.py:511-528 | moments/LD/stats_from_genotype_counts.py:598-615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×3
  • Duplicated block (16 lines × 2) moments/LinearSystem.py:111 — moments/LinearSystem.py:111-126 | moments/LinearSystem.py:272-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) moments/Misc.py:473 — moments/Misc.py:473-488 | moments/Misc.py:495-510 — both copies are in the same file, so extract the 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 (16 lines × 2) moments/TwoLocus/Numerics.py:509 — moments/TwoLocus/Numerics.py:509-524 | moments/TwoLocus/Numerics.py:547-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) moments/Godambe.py:334 — moments/Godambe.py:334-345 | moments/Godambe.py:439-450 | moments/Godambe.py:504-515 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Godambe.py:438` calls `concatenate` and `moments/Godambe.py:333` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) REDACTED:1083 — REDACTED:1083-1094 | REDACTED:569-580 | REDACTED:758-769 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:566` calls `any`, `ValueError` and `REDACTED:1082` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) moments/TwoLocus/Util.py:129 — moments/TwoLocus/Util.py:129-140 | moments/TwoLocus/Util.py:163-174 | moments/TwoLocus/Util.py:226-237 — 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 (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) moments/LD/stats_from_genotype_counts.py:518 — moments/LD/stats_from_genotype_counts.py:518-528 | moments/LD/stats_from_genotype_counts.py:568-578 | moments/LD/stats_from_genotype_counts.py:605-615 — 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 (11 lines × 3) moments/LD/stats_from_genotype_counts.py:695 — moments/LD/stats_from_genotype_counts.py:695-705 | moments/LD/stats_from_genotype_counts.py:715-725 | moments/LD/stats_from_genotype_counts.py:735-745 — 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 (11 lines × 3) moments/LD/stats_from_haplotype_counts.py:212 — moments/LD/stats_from_haplotype_counts.py:212-222 | moments/LD/stats_from_haplotype_counts.py:229-239 | moments/LD/stats_from_haplotype_counts.py:261-271 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_haplotype_counts.py:212` 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 (9–10 lines × 2) · ×3
  • Duplicated block (9–10 lines × 2) moments/TwoLocus/Util.py:178 — moments/TwoLocus/Util.py:178-186 | moments/TwoLocus/Util.py:205-214 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Util.py:178` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) moments/TwoLocus/Util.py:249 — moments/TwoLocus/Util.py:249-257 | moments/TwoLocus/Util.py:292-301 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Util.py:249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) moments/TwoLocus/Util.py:352 — moments/TwoLocus/Util.py:352-360 | moments/TwoLocus/Util.py:403-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/TwoLocus/Util.py:352` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×3
  • Duplicated block (9 lines × 5) moments/LD/Matrices.py:512 — moments/LD/Matrices.py:512-520 | moments/LD/Matrices.py:533-541 | moments/LD/Matrices.py:557-565 | moments/LD/Matrices.py:578-586 | moments/LD/Matrices.py:602-610 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:512` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 5) moments/LD/Matrices.py:744 — moments/LD/Matrices.py:744-752 | moments/LD/Matrices.py:767-775 | moments/LD/Matrices.py:841-849 | moments/LD/Matrices.py:868-876 | moments/LD/Matrices.py:902-910 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:744` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 5) moments/LD/Matrices.py:777 — moments/LD/Matrices.py:777-785 | moments/LD/Matrices.py:804-812 | moments/LD/Matrices.py:831-839 | moments/LD/Matrices.py:858-866 | moments/LD/Matrices.py:885-893 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:777` 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 (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) moments/LD/stats_from_genotype_counts.py:519 — moments/LD/stats_from_genotype_counts.py:519-527 | moments/LD/stats_from_genotype_counts.py:544-552 | moments/LD/stats_from_genotype_counts.py:569-577 | moments/LD/stats_from_genotype_counts.py:606-614 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) moments/LD/stats_from_haplotype_counts.py:86 — moments/LD/stats_from_haplotype_counts.py:86-94 | moments/LD/stats_from_haplotype_counts.py:213-221 | moments/LD/stats_from_haplotype_counts.py:230-238 | moments/LD/stats_from_haplotype_counts.py:262-270 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) moments/Triallele/Numerics.py:414 — moments/Triallele/Numerics.py:414-422 | moments/Triallele/Numerics.py:434-442 | moments/Triallele/Numerics.py:480-488 | moments/Triallele/Numerics.py:536-544 — 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 `moments/Triallele/Numerics.py:414` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Triallele/Numerics.py:478` calls `choose` and `moments/Triallele/Numerics.py:412` 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 (8 lines × 4) · ×3
  • Duplicated block (8 lines × 4) moments/Triallele/Numerics.py:342 — moments/Triallele/Numerics.py:342-349 | moments/Triallele/Numerics.py:406-413 | moments/Triallele/Numerics.py:425-432 | moments/Triallele/Numerics.py:547-554 — 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 `moments/Triallele/Numerics.py:342` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Triallele/Numerics.py:423` calls `choose` and `moments/Triallele/Numerics.py:340` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) moments/TwoLocus/Util.py:126 — moments/TwoLocus/Util.py:126-133 | moments/TwoLocus/Util.py:160-167 | moments/TwoLocus/Util.py:223-230 | moments/TwoLocus/Util.py:322-329 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 4) moments/TwoLocus/Util.py:145 — moments/TwoLocus/Util.py:145-152 | moments/TwoLocus/Util.py:195-202 | moments/TwoLocus/Util.py:274-281 | moments/TwoLocus/Util.py:381-388 — 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 `moments/TwoLocus/Util.py:145` 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 × 4) · ×3
  • Duplicated block (7 lines × 4) moments/LD/Matrices.py:644 — moments/LD/Matrices.py:644-650 | moments/LD/Matrices.py:664-670 | moments/LD/Matrices.py:725-731 | moments/LD/Matrices.py:752-758 — 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 `moments/LD/Matrices.py:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) moments/Triallele/Numerics.py:343 — moments/Triallele/Numerics.py:343-349 | moments/Triallele/Numerics.py:369-375 | moments/Triallele/Numerics.py:388-394 | moments/Triallele/Numerics.py:407-413 — 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 `moments/Triallele/Numerics.py:343` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/Triallele/Numerics.py:396` calls `choose` and `moments/Triallele/Numerics.py:415` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) moments/Triallele/Numerics.py:372 — moments/Triallele/Numerics.py:372-378 | moments/Triallele/Numerics.py:410-416 | moments/Triallele/Numerics.py:494-500 | moments/Triallele/Numerics.py:512-518 — 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 `moments/Triallele/Numerics.py:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×3
  • Duplicated block (6–7 lines × 2) moments/LD/stats_from_genotype_counts.py:680 — moments/LD/stats_from_genotype_counts.py:680-686 | moments/LD/stats_from_genotype_counts.py:1377-1382 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:680` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–7 lines × 2) moments/LD/stats_from_genotype_counts.py:863 — moments/LD/stats_from_genotype_counts.py:863-869 | moments/LD/stats_from_genotype_counts.py:1170-1175 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:863` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–7 lines × 2) moments/LD/stats_from_genotype_counts.py:1137 — moments/LD/stats_from_genotype_counts.py:1137-1142 | moments/LD/stats_from_genotype_counts.py:1144-1150 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×3
  • Duplicated block (5 lines × 5) moments/LD/stats_from_genotype_counts.py:447 — moments/LD/stats_from_genotype_counts.py:447-451 | moments/LD/stats_from_genotype_counts.py:1232-1236 | moments/LD/stats_from_genotype_counts.py:1273-1277 | moments/LD/stats_from_genotype_counts.py:1329-1333 | moments/LD/stats_from_genotype_counts.py:1395-1399 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/LD/stats_from_genotype_counts.py:1400` calls `sum` and `moments/LD/stats_from_genotype_counts.py:452` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 5) moments/Manips.py:127 — moments/Manips.py:127-131 | moments/Manips.py:185-189 | moments/Manips.py:248-252 | moments/Manips.py:312-316 | moments/Manips.py:374-378 — 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.
  • Duplicated block (5 lines × 5) moments/Triallele/Jackknife.py:52 — moments/Triallele/Jackknife.py:52-56 | moments/Triallele/Jackknife.py:112-116 | REDACTED:197-201 | REDACTED:217-221 | REDACTED:237-241 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×3
  • Duplicated block (3–5 lines × 3) moments/LD/Parsing.py:1077 — moments/LD/Parsing.py:1077-1081 | moments/LD/Parsing.py:1085-1089 | moments/LD/Parsing.py:1092-1094 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Parsing.py:1077` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (3–5 lines × 3) moments/LD/stats_from_genotype_counts.py:1040 — moments/LD/stats_from_genotype_counts.py:1040-1042 | moments/LD/stats_from_genotype_counts.py:1260-1264 | moments/LD/stats_from_genotype_counts.py:1426-1430 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:1040` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (3–5 lines × 3) REDACTED:177 — REDACTED:177-181 | REDACTED:259-261 | REDACTED:310-314 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D17 · Explicit Debt · XxxComment · ×2
  • XxxComment moments/Plotting.py:939 — # XXX: I can't set the axis ticks to be just the endpoints. — 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.
  • XxxComment REDACTED:313 — # XXX don't think this is needed — 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.
D17 · Explicit Debt · TodoComment · ×2
  • TodoComment REDACTED:540 — ## 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 moments/LD/Godambe.py:563 — # TODO: complete docstring — 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.
D36 · Supply-chain Provenance & Signing REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×2
  • Duplicated block (40 lines × 2) moments/LD/Matrices.py:2576 — moments/LD/Matrices.py:2576-2615 | moments/LD/Matrices.py:2634-2673 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:2576` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (40 lines × 2) moments/Parsing.py:868 — moments/Parsing.py:868-907 | moments/Parsing.py:911-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×2
  • Duplicated block (37 lines × 2) moments/Godambe.py:47 — moments/Godambe.py:47-83 | moments/LD/Godambe.py:66-102 — 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 (37 lines × 2) moments/Manips.py:85 — moments/Manips.py:85-121 | moments/Manips.py:143-179 — both copies are in the same file, so extract the 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 (35 lines × 2) · ×2
  • Duplicated block (35 lines × 2) moments/LD/Matrices.py:4119 — moments/LD/Matrices.py:4119-4153 | moments/LD/Matrices.py:4876-4910 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:4119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (35 lines × 2) moments/LinearSystem.py:140 — moments/LinearSystem.py:140-174 | moments/LinearSystem.py:223-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) moments/Plotting.py:711 — moments/Plotting.py:711-737 | moments/Plotting.py:1083-1109 — both copies are in the same file, so extract the 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 `moments/Plotting.py:711` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) REDACTED:802 — REDACTED:802-828 | REDACTED:839-865 — both copies are in the same file, so extract the 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 (22–23 lines × 4) · ×2
  • Duplicated block (22–23 lines × 4) moments/LD/Matrices.py:2757 — moments/LD/Matrices.py:2757-2779 | moments/LD/Matrices.py:2847-2869 | moments/LD/Matrices.py:3065-3086 | moments/LD/Matrices.py:3173-3194 — 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 `moments/LD/Matrices.py:2757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22–23 lines × 4) moments/LD/Matrices.py:2787 — moments/LD/Matrices.py:2787-2809 | moments/LD/Matrices.py:2877-2899 | moments/LD/Matrices.py:3101-3122 | moments/LD/Matrices.py:3209-3230 — 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 `moments/LD/Matrices.py:2787` 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 (21 lines × 6) · ×2
  • Duplicated block (21 lines × 6) moments/LD/Matrices.py:1171 — moments/LD/Matrices.py:1171-1191 | moments/LD/Matrices.py:1220-1240 | moments/LD/Matrices.py:1781-1801 | moments/LD/Matrices.py:1830-1850 | moments/LD/Matrices.py:1879-1899 | moments/LD/Matrices.py:1928-1948 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 6) moments/LD/Matrices.py:2763 — moments/LD/Matrices.py:2763-2783 | moments/LD/Matrices.py:2823-2843 | moments/LD/Matrices.py:2853-2873 | moments/LD/Matrices.py:3070-3090 | moments/LD/Matrices.py:3142-3162 | moments/LD/Matrices.py:3178-3198 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2763` 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 (19 lines × 3) · ×2
  • Duplicated block (19 lines × 3) REDACTED:106 — REDACTED:106-124 | REDACTED:166-186 | REDACTED:195-214 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:166` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (19 lines × 3) moments/LD/Matrices.py:1373 — moments/LD/Matrices.py:1373-1391 | moments/LD/Matrices.py:1558-1576 | moments/LD/Matrices.py:1635-1653 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1373` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) moments/LD/stats_from_genotype_counts.py:1309 — moments/LD/stats_from_genotype_counts.py:1309-1327 | moments/LD/stats_from_haplotype_counts.py:246-264 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:1309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) moments/TwoLocus/Util.py:362 — moments/TwoLocus/Util.py:362-380 | moments/TwoLocus/Util.py:413-431 — both copies are in the same file, so extract the 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 `moments/TwoLocus/Util.py:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) REDACTED:469 — REDACTED:469-483 | REDACTED:691-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:469` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) moments/LD/Parsing.py:327 — moments/LD/Parsing.py:327-341 | moments/LD/Parsing.py:345-358 — both copies are in the same file, so extract the 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 (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) moments/Manips.py:104 — moments/Manips.py:104-117 | moments/Manips.py:162-175 | moments/Manips.py:349-362 — 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 (14 lines × 3) moments/TwoLocus/Util.py:192 — moments/TwoLocus/Util.py:192-205 | moments/TwoLocus/Util.py:271-284 | moments/TwoLocus/Util.py:378-391 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/TwoLocus/Util.py:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 9) · ×2
  • Duplicated block (13 lines × 9) moments/LD/Matrices.py:1323 — moments/LD/Matrices.py:1323-1335 | moments/LD/Matrices.py:1454-1466 | moments/LD/Matrices.py:1482-1494 | moments/LD/Matrices.py:1538-1550 | moments/LD/Matrices.py:1615-1627 | moments/LD/Matrices.py:3039-3055 | moments/LD/Matrices.py:3075-3091 | moments/LD/Matrices.py:3147-3163 | moments/LD/Matrices.py:3183-3199 — all 9 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 `moments/LD/Matrices.py:1323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 9) moments/LD/Matrices.py:1538 — moments/LD/Matrices.py:1538-1550 | moments/LD/Matrices.py:1615-1627 | moments/LD/Matrices.py:2768-2784 | moments/LD/Matrices.py:2828-2844 | moments/LD/Matrices.py:2858-2874 | moments/LD/Matrices.py:3039-3055 | moments/LD/Matrices.py:3075-3091 | moments/LD/Matrices.py:3147-3163 | moments/LD/Matrices.py:3183-3199 — all 9 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 `moments/LD/Matrices.py:1538` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×2
  • Duplicated block (13 lines × 4) moments/LD/Matrices.py:1024 — moments/LD/Matrices.py:1024-1037 | moments/LD/Matrices.py:1372-1385 | moments/LD/Matrices.py:1558-1570 | moments/LD/Matrices.py:1635-1647 — 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 `moments/LD/Matrices.py:1024` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) moments/LD/Matrices.py:1343 — moments/LD/Matrices.py:1343-1355 | moments/LD/Matrices.py:1357-1369 | moments/LD/Matrices.py:2582-2599 | moments/LD/Matrices.py:2640-2657 — 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 `moments/LD/Matrices.py:1343` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) moments/Demes/Inference.py:657 — moments/Demes/Inference.py:657-669 | moments/Demes/Inference.py:1244-1255 — both copies are in the same file, so extract the 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 `moments/Demes/Inference.py:657` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12–13 lines × 2) moments/Triallele/Numerics.py:517 — moments/Triallele/Numerics.py:517-529 | moments/Triallele/Numerics.py:566-577 — both copies are in the same file, so extract the 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 `moments/Triallele/Numerics.py:517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) moments/LD/Parsing.py:858 — moments/LD/Parsing.py:858-869 | moments/LD/Parsing.py:906-916 — both copies are in the same file, so extract the 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 `moments/LD/Parsing.py:858` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/LD/Parsing.py:904` calls `pi2` and `moments/LD/Parsing.py:858` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–12 lines × 2) moments/LD/stats_from_genotype_counts.py:877 — moments/LD/stats_from_genotype_counts.py:877-888 | moments/LD/stats_from_genotype_counts.py:989-999 — both copies are in the same file, so extract the 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 (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) moments/LD/Matrices.py:80 — moments/LD/Matrices.py:80-89 | moments/LD/Matrices.py:99-108 | moments/LD/Matrices.py:116-125 — 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 (10 lines × 3) moments/LD/Matrices.py:459 — moments/LD/Matrices.py:459-468 | moments/LD/Matrices.py:475-484 | moments/LD/Matrices.py:489-498 — 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 (9–10 lines × 3) · ×2
  • Duplicated block (9–10 lines × 3) moments/LinearSystem.py:119 — moments/LinearSystem.py:119-128 | moments/LinearSystem.py:193-201 | moments/LinearSystem.py:280-289 — 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 (9–10 lines × 3) REDACTED:984 — REDACTED:984-992 | REDACTED:1029-1038 | REDACTED:1044-1053 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:984` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) moments/LD/stats_from_genotype_counts.py:497 — moments/LD/stats_from_genotype_counts.py:497-503 | moments/LD/stats_from_genotype_counts.py:520-526 | moments/LD/stats_from_genotype_counts.py:545-551 | moments/LD/stats_from_genotype_counts.py:565-571 | moments/LD/stats_from_genotype_counts.py:607-613 — 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.
  • Duplicated block (7 lines × 5) REDACTED:210 — REDACTED:210-216 | REDACTED:221-233 | REDACTED:238-250 | REDACTED:255-267 | REDACTED:272-284 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×2
  • Duplicated block (6–7 lines × 3) moments/LD/stats_from_genotype_counts.py:659 — moments/LD/stats_from_genotype_counts.py:659-665 | moments/LD/stats_from_genotype_counts.py:1240-1245 | moments/LD/stats_from_genotype_counts.py:1405-1410 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–7 lines × 3) moments/LD/stats_from_haplotype_counts.py:51 — moments/LD/stats_from_haplotype_counts.py:51-57 | moments/LD/stats_from_haplotype_counts.py:63-69 | moments/LD/stats_from_haplotype_counts.py:75-80 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_haplotype_counts.py:51` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D1 · Cyclomatic Complexity · Matrices.admix_ld (cyclomatic 216) · ×1
  • Matrices.admix_ld (cyclomatic 216) moments/LD/Matrices.py:995 — Matrices.admix_ld has cyclomatic complexity 216 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This file is where this pass's cyclomatic complexity CONCENTRATES: moments/LD/Matrices.py holds 4 of the 58 methods over the threshold — including the worst — and 315 of the 915 points over it (34%), 2.2× the next-largest file (moments/Demes/Demes.py at 145). 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 · Matrices.migration_ld (cyclomatic 103) · ×1
  • Matrices.migration_ld (cyclomatic 103) moments/LD/Matrices.py:415 — Matrices.migration_ld has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent 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: moments/LD/Matrices.py holds 4 of the 58 methods over the threshold — including the worst — and 315 of the 915 points over it (34%), 2.2× the next-largest file (moments/Demes/Demes.py at 145). 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 · Demes.SFS (cyclomatic 82) · ×1
  • Demes.SFS (cyclomatic 82) moments/Demes/Demes.py:17 — Demes.SFS has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parsing._tally_vcf (cyclomatic 72) · ×1
  • Parsing._tally_vcf (cyclomatic 72) moments/Parsing.py:317 — Parsing._tally_vcf has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parsing._count_types_sparse (cyclomatic 43) · ×1
  • Parsing._count_types_sparse (cyclomatic 43) moments/LD/Parsing.py:549 — Parsing._count_types_sparse has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Demes._get_deme_sample_sizes (cyclomatic 40) · ×1
  • Demes._get_deme_sample_sizes (cyclomatic 40) moments/Demes/Demes.py:1023 — Demes._get_deme_sample_sizes has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Matrices.drift_ld (cyclomatic 40) · ×1
  • Matrices.drift_ld (cyclomatic 40) moments/LD/Matrices.py:35 — Matrices.drift_ld has cyclomatic complexity 40 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This file is where this pass's cyclomatic complexity CONCENTRATES: moments/LD/Matrices.py holds 4 of the 58 methods over the threshold — including the worst — and 315 of the 915 points over it (34%), 2.2× the next-largest file (moments/Demes/Demes.py at 145). 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 · Jackknife.closest_ijk_edges (cyclomatic 39) · ×1
  • Jackknife.closest_ijk_edges (cyclomatic 39) REDACTED:267 — Jackknife.closest_ijk_edges has cyclomatic complexity 39 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Integration.integrate_nD (cyclomatic 37) · ×1
  • Integration.integrate_nD (cyclomatic 37) REDACTED:889 — Integration.integrate_nD has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Misc.make_data_dict_vcf (cyclomatic 37) · ×1
  • Misc.make_data_dict_vcf (cyclomatic 37) moments/Misc.py:409 — Misc.make_data_dict_vcf has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Integration.integrate (cyclomatic 36) · ×1
  • Integration.integrate (cyclomatic 36) moments/TwoLocus/Integration.py:15 — Integration.integrate has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelPlot.plot_model (cyclomatic 34) · ×1
  • ModelPlot.plot_model (cyclomatic 34) moments/ModelPlot.py:82 — ModelPlot.plot_model 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 · Plotting.plot_ld_curves_comp (cyclomatic 32) · ×1
  • Plotting.plot_ld_curves_comp (cyclomatic 32) moments/LD/Plotting.py:120 — Plotting.plot_ld_curves_comp has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Demes.LD (cyclomatic 31) · ×1
  • Demes.LD (cyclomatic 31) moments/Demes/Demes.py:387 — Demes.LD has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Jackknife.calc_jk (cyclomatic 31) · ×1
  • Jackknife.calc_jk (cyclomatic 31) REDACTED:887 — Jackknife.calc_jk has cyclomatic complexity 31 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Demes.LDdecay (cyclomatic 27) · ×1
  • Demes.LDdecay (cyclomatic 27) moments/Demes/Demes.py:543 — Demes.LDdecay has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LDstats.integrate (cyclomatic 27) · ×1
  • LDstats.integrate (cyclomatic 27) REDACTED:961 — LDstats.integrate has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Misc.bootstrap (cyclomatic 27) · ×1
  • Misc.bootstrap (cyclomatic 27) moments/Misc.py:672 — Misc.bootstrap has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Jackknife.closest_ijk (cyclomatic 27) · ×1
  • Jackknife.closest_ijk (cyclomatic 27) REDACTED:51 — Jackknife.closest_ijk has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Demes._get_demographic_events (cyclomatic 26) · ×1
  • Demes._get_demographic_events (cyclomatic 26) moments/Demes/Demes.py:745 — Demes._get_demographic_events has cyclomatic complexity 26 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Demes._compute_sfs (cyclomatic 26) · ×1
  • Demes._compute_sfs (cyclomatic 26) moments/Demes/Demes.py:1165 — Demes._compute_sfs has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Integration_nomig.integrate_nomig (cyclomatic 26) · ×1
  • Integration_nomig.integrate_nomig (cyclomatic 26) REDACTED:402 — Integration_nomig.integrate_nomig has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Numerics.integrate (cyclomatic 26) · ×1
  • Numerics.integrate (cyclomatic 26) moments/LD/Numerics.py:192 — Numerics.integrate has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Spectrum.integrate (cyclomatic 26) · ×1
  • Spectrum.integrate (cyclomatic 26) REDACTED:672 — Spectrum.integrate has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Jackknife.closest_ijk_sides (cyclomatic 25) · ×1
  • Jackknife.closest_ijk_sides (cyclomatic 25) REDACTED:141 — Jackknife.closest_ijk_sides has cyclomatic complexity 25 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Inference._set_value (cyclomatic 24) · ×1
  • Inference._set_value (cyclomatic 24) moments/Demes/Inference.py:133 — Inference._set_value has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Numerics.steady_state (cyclomatic 24) · ×1
  • Numerics.steady_state (cyclomatic 24) moments/LD/Numerics.py:380 — Numerics.steady_state has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · stats_from_genotype_counts.pi2 (cyclomatic 24) · ×1
  • stats_from_genotype_counts.pi2 (cyclomatic 24) moments/LD/stats_from_genotype_counts.py:468 — stats_from_genotype_counts.pi2 has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Spectrum.f4 (cyclomatic 24) · ×1
  • Spectrum.f4 (cyclomatic 24) REDACTED:1206 — Spectrum.f4 has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Numerics.drift (cyclomatic 24) · ×1
  • Numerics.drift (cyclomatic 24) moments/TwoLocus/Numerics.py:68 — Numerics.drift has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Inference._get_value (cyclomatic 23) · ×1
  • Inference._get_value (cyclomatic 23) moments/Demes/Inference.py:60 — Inference._get_value 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 · Inference._object_func (cyclomatic 23) · ×1
  • Inference._object_func (cyclomatic 23) moments/LD/Inference.py:295 — Inference._object_func 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 · stats_from_haplotype_counts.pi2 (cyclomatic 23) · ×1
  • stats_from_haplotype_counts.pi2 (cyclomatic 23) moments/LD/stats_from_haplotype_counts.py:105 — stats_from_haplotype_counts.pi2 has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Plotting.plot_3d_spectrum (cyclomatic 23) · ×1
  • Plotting.plot_3d_spectrum (cyclomatic 23) moments/Plotting.py:803 — Plotting.plot_3d_spectrum 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 · Plotting.plot_4d_comp_Poisson (cyclomatic 21) · ×1
  • Plotting.plot_4d_comp_Poisson (cyclomatic 21) moments/Plotting.py:997 — Plotting.plot_4d_comp_Poisson 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 · Integration.integrate_cn (cyclomatic 21) · ×1
  • Integration.integrate_cn (cyclomatic 21) moments/Triallele/Integration.py:29 — Integration.integrate_cn 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 · Inference.optimize (cyclomatic 20) · ×1
  • Inference.optimize (cyclomatic 20) moments/Demes/Inference.py:419 — Inference.optimize has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Integration_nomig.integrate_neutral (cyclomatic 20) · ×1
  • Integration_nomig.integrate_neutral (cyclomatic 20) REDACTED:644 — Integration_nomig.integrate_neutral 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 · Parsing.get_genotypes (cyclomatic 20) · ×1
  • Parsing.get_genotypes (cyclomatic 20) moments/LD/Parsing.py:98 — Parsing.get_genotypes 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 · Util.rescale_params (cyclomatic 20) · ×1
  • Util.rescale_params (cyclomatic 20) moments/LD/Util.py:150 — Util.rescale_params has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Parsing._parse_filters (cyclomatic 20) · ×1
  • Parsing._parse_filters (cyclomatic 20) moments/Parsing.py:683 — Parsing._parse_filters 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 · Plotting.plot_3d_comp_Poisson (cyclomatic 20) · ×1
  • Plotting.plot_3d_comp_Poisson (cyclomatic 20) moments/Plotting.py:634 — Plotting.plot_3d_comp_Poisson 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 · Spectrum.__new__ (cyclomatic 20) · ×1
  • Spectrum.__new__ (cyclomatic 20) REDACTED:78 — Spectrum.__new__ 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 · Parsing._call_sgc (cyclomatic 19) · ×1
  • Parsing._call_sgc (cyclomatic 19) moments/LD/Parsing.py:790 — Parsing._call_sgc has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Spectrum.f3 (cyclomatic 19) · ×1
  • Spectrum.f3 (cyclomatic 19) REDACTED:1134 — Spectrum.f3 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Demes._augment_with_ancient_samples (cyclomatic 18) · ×1
  • Demes._augment_with_ancient_samples (cyclomatic 18) moments/Demes/Demes.py:683 — Demes._augment_with_ancient_samples 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 · LDstats.to_file (cyclomatic 18) · ×1
  • LDstats.to_file (cyclomatic 18) REDACTED:671 — LDstats.to_file has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Inference.optimize_LD (cyclomatic 17) · ×1
  • Inference.optimize_LD (cyclomatic 17) moments/Demes/Inference.py:1018 — Inference.optimize_LD 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 · Util._compute_D (cyclomatic 17) · ×1
  • Util._compute_D (cyclomatic 17) moments/TwoLocus/Util.py:125 — Util._compute_D 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: 3 other methods here (Util._compute_D2, Util._compute_Dz, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Util._compute_D2 (cyclomatic 17) · ×1
  • Util._compute_D2 (cyclomatic 17) moments/TwoLocus/Util.py:159 — Util._compute_D2 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: 3 other methods here (Util._compute_D, Util._compute_Dz, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Util._compute_Dz (cyclomatic 17) · ×1
  • Util._compute_Dz (cyclomatic 17) moments/TwoLocus/Util.py:222 — Util._compute_Dz 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: 3 other methods here (Util._compute_D, Util._compute_D2, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Util._compute_pi2 (cyclomatic 17) · ×1
  • Util._compute_pi2 (cyclomatic 17) moments/TwoLocus/Util.py:321 — Util._compute_pi2 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: 3 other methods here (Util._compute_D, Util._compute_D2, Util._compute_Dz) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Matrices.mutation_ld (cyclomatic 16) · ×1
  • Matrices.mutation_ld (cyclomatic 16) moments/LD/Matrices.py:258 — Matrices.mutation_ld 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. This file is where this pass's cyclomatic complexity CONCENTRATES: moments/LD/Matrices.py holds 4 of the 58 methods over the threshold — including the worst — and 315 of the 915 points over it (34%), 2.2× the next-largest file (moments/Demes/Demes.py at 145). 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 · Parsing.subset_data (cyclomatic 16) · ×1
  • Parsing.subset_data (cyclomatic 16) moments/LD/Parsing.py:1504 — Parsing.subset_data has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Plotting.plot_ld_curves (cyclomatic 16) · ×1
  • Plotting.plot_ld_curves (cyclomatic 16) moments/LD/Plotting.py:23 — Plotting.plot_ld_curves 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 · Plotting.plot_2d_comp_Poisson (cyclomatic 16) · ×1
  • Plotting.plot_2d_comp_Poisson (cyclomatic 16) moments/Plotting.py:439 — Plotting.plot_2d_comp_Poisson has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TriSpectrum.fold_ancestral (cyclomatic 16) · ×1
  • TriSpectrum.fold_ancestral (cyclomatic 16) REDACTED:346 — TriSpectrum.fold_ancestral 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 · Numerics.drift_reversible (cyclomatic 16) · ×1
  • Numerics.drift_reversible (cyclomatic 16) moments/TwoLocus/Numerics.py:960 — Numerics.drift_reversible 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 · Matrices.migration_ld (cognitive 358) · ×1
  • Matrices.migration_ld (cognitive 358) moments/LD/Matrices.py:415 — Matrices.migration_ld has cognitive complexity 358 (threshold 15). Drivers by points: if/else 59 (264 pts), loops 25 (92 pts), boolean chains 2 (nesting depth added 272). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parsing._tally_vcf (cognitive 158) · ×1
  • Parsing._tally_vcf (cognitive 158) moments/Parsing.py:317 — Parsing._tally_vcf has cognitive complexity 158 (threshold 15). Drivers by points: if/else 57 (130 pts), loops 8 (20 pts), boolean chains 8 (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes.SFS (cognitive 152) · ×1
  • Demes.SFS (cognitive 152) moments/Demes/Demes.py:17 — Demes.SFS has cognitive complexity 152 (threshold 15). Drivers by points: if/else 65 (113 pts), loops 13 (27 pts), boolean chains 12 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Matrices.admix_ld (cognitive 134) · ×1
  • Matrices.admix_ld (cognitive 134) moments/LD/Matrices.py:995 — Matrices.admix_ld has cognitive complexity 134 (threshold 15). Drivers by points: boolean chains 82, if/else 19 (51 pts), loops 1 (nesting depth added 32). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Demes._get_deme_sample_sizes (cognitive 123) · ×1
  • Demes._get_deme_sample_sizes (cognitive 123) moments/Demes/Demes.py:1023 — Demes._get_deme_sample_sizes has cognitive complexity 123 (threshold 15). Drivers by points: if/else 13 (65 pts), loops 15 (52 pts), boolean chains 6 (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Jackknife.calc_jk (cognitive 112) · ×1
  • Jackknife.calc_jk (cognitive 112) REDACTED:887 — Jackknife.calc_jk has cognitive complexity 112 (threshold 15). Drivers by points: loops 28 (108 pts), if/else 2 (3 pts), error handling 1 (nesting depth added 81). 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 · Parsing._count_types_sparse (cognitive 99) · ×1
  • Parsing._count_types_sparse (cognitive 99) moments/LD/Parsing.py:549 — Parsing._count_types_sparse has cognitive complexity 99 (threshold 15). Drivers by points: if/else 31 (53 pts), loops 18 (44 pts), error handling 1 (2 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference._set_value (cognitive 88) · ×1
  • Inference._set_value (cognitive 88) moments/Demes/Inference.py:133 — Inference._set_value has cognitive complexity 88 (threshold 15). Drivers by points: if/else 13 (48 pts), loops 7 (27 pts), error handling 2 (13 pts) (nesting depth added 66). 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 · Numerics.drift (cognitive 84) · ×1
  • Numerics.drift (cognitive 84) moments/TwoLocus/Numerics.py:68 — Numerics.drift has cognitive complexity 84 (threshold 15). Drivers by points: if/else 16 (75 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Misc.make_data_dict_vcf (cognitive 81) · ×1
  • Misc.make_data_dict_vcf (cognitive 81) moments/Misc.py:409 — Misc.make_data_dict_vcf has cognitive complexity 81 (threshold 15). Drivers by points: if/else 24 (63 pts), loops 4 (7 pts), boolean chains 6, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Integration.integrate_nD (cognitive 80) · ×1
  • Integration.integrate_nD (cognitive 80) REDACTED:889 — Integration.integrate_nD has cognitive complexity 80 (threshold 15). Drivers by points: if/else 39 (61 pts), loops 5 (17 pts), boolean chains 2 (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 · Inference._get_value (cognitive 76) · ×1
  • Inference._get_value (cognitive 76) moments/Demes/Inference.py:60 — Inference._get_value has cognitive complexity 76 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 7 (27 pts), error handling 2 (13 pts) (nesting depth added 54). 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 · ModelPlot.plot_model (cognitive 71) · ×1
  • ModelPlot.plot_model (cognitive 71) moments/ModelPlot.py:82 — ModelPlot.plot_model has cognitive complexity 71 (threshold 15). Drivers by points: if/else 25 (40 pts), ternaries 5 (15 pts), loops 6 (13 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · Demes._augment_with_ancient_samples (cognitive 68) · ×1
  • Demes._augment_with_ancient_samples (cognitive 68) moments/Demes/Demes.py:683 — Demes._augment_with_ancient_samples has cognitive complexity 68 (threshold 15). Drivers by points: if/else 10 (46 pts), loops 5 (21 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · Numerics.integrate (cognitive 65) · ×1
  • Numerics.integrate (cognitive 65) moments/LD/Numerics.py:192 — Numerics.integrate has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (61 pts), boolean chains 3, loops 1 (nesting depth added 31). 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 · Parsing._parse_filters (cognitive 65) · ×1
  • Parsing._parse_filters (cognitive 65) moments/Parsing.py:683 — Parsing._parse_filters has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (53 pts), loops 3 (9 pts), error handling 1 (3 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Misc.bootstrap (cognitive 62) · ×1
  • Misc.bootstrap (cognitive 62) moments/Misc.py:672 — Misc.bootstrap has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 9 (22 pts), ternaries 2 (5 pts), boolean chains 2 (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 · Integration.integrate (cognitive 62) · ×1
  • Integration.integrate (cognitive 62) moments/TwoLocus/Integration.py:15 — Integration.integrate has cognitive complexity 62 (threshold 15). Drivers by points: if/else 33 (56 pts), boolean chains 5, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Matrices.drift_ld (cognitive 61) · ×1
  • Matrices.drift_ld (cognitive 61) moments/LD/Matrices.py:35 — Matrices.drift_ld has cognitive complexity 61 (threshold 15). Drivers by points: loops 11 (39 pts), if/else 10 (20 pts), boolean chains 2 (nesting depth added 38). 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 · Demes._compute_sfs (cognitive 58) · ×1
  • Demes._compute_sfs (cognitive 58) moments/Demes/Demes.py:1165 — Demes._compute_sfs has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (34 pts), loops 5 (15 pts), ternaries 2 (8 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Integration_nomig.integrate_nomig (cognitive 56) · ×1
  • Integration_nomig.integrate_nomig (cognitive 56) REDACTED:402 — Integration_nomig.integrate_nomig has cognitive complexity 56 (threshold 15). Drivers by points: if/else 28 (47 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plotting.plot_3d_spectrum (cognitive 54) · ×1
  • Plotting.plot_3d_spectrum (cognitive 54) moments/Plotting.py:803 — Plotting.plot_3d_spectrum has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 6, loops 3 (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 · Numerics.drift_reversible (cognitive 54) · ×1
  • Numerics.drift_reversible (cognitive 54) moments/TwoLocus/Numerics.py:960 — Numerics.drift_reversible has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (48 pts), loops 3 (6 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinearSystem.calcM_jk3 (cognitive 52) · ×1
  • LinearSystem.calcM_jk3 (cognitive 52) moments/LinearSystem.py:263 — LinearSystem.calcM_jk3 has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (45 pts), loops 4 (7 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plotting.plot_ld_curves_comp (cognitive 51) · ×1
  • Plotting.plot_ld_curves_comp (cognitive 51) moments/LD/Plotting.py:120 — Plotting.plot_ld_curves_comp has cognitive complexity 51 (threshold 15). Drivers by points: if/else 22 (34 pts), loops 6 (13 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Integration_nomig.integrate_neutral (cognitive 48) · ×1
  • Integration_nomig.integrate_neutral (cognitive 48) REDACTED:644 — Integration_nomig.integrate_neutral has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (36 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Util._compute_D (cognitive 48) · ×1
  • Util._compute_D (cognitive 48) moments/TwoLocus/Util.py:125 — Util._compute_D has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Util._compute_D2, Util._compute_Dz, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · Util._compute_D2 (cognitive 48) · ×1
  • Util._compute_D2 (cognitive 48) moments/TwoLocus/Util.py:159 — Util._compute_D2 has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Util._compute_D, Util._compute_Dz, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · Util._compute_Dz (cognitive 48) · ×1
  • Util._compute_Dz (cognitive 48) moments/TwoLocus/Util.py:222 — Util._compute_Dz has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Util._compute_D, Util._compute_D2, Util._compute_pi2) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · Util._compute_pi2 (cognitive 48) · ×1
  • Util._compute_pi2 (cognitive 48) moments/TwoLocus/Util.py:321 — Util._compute_pi2 has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Util._compute_D, Util._compute_D2, Util._compute_Dz) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · Integration.integrate_cn (cognitive 46) · ×1
  • Integration.integrate_cn (cognitive 46) moments/Triallele/Integration.py:29 — Integration.integrate_cn has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (38 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes.LD (cognitive 44) · ×1
  • Demes.LD (cognitive 44) moments/Demes/Demes.py:387 — Demes.LD has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 5, loops 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Jackknife.closest_ijk_edges (cognitive 41) · ×1
  • Jackknife.closest_ijk_edges (cognitive 41) REDACTED:267 — Jackknife.closest_ijk_edges has cognitive complexity 41 (threshold 15). Drivers by points: loops 12 (24 pts), boolean chains 14, if/else 3 (nesting depth added 12). 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 · Matrices.mutation_ld (cognitive 40) · ×1
  • Matrices.mutation_ld (cognitive 40) moments/LD/Matrices.py:258 — Matrices.mutation_ld has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Jackknife.closest_ijk (cognitive 40) · ×1
  • Jackknife.closest_ijk (cognitive 40) REDACTED:51 — Jackknife.closest_ijk has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 12, loops 6 (10 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference._object_func (cognitive 39) · ×1
  • Inference._object_func (cognitive 39) moments/LD/Inference.py:295 — Inference._object_func has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22 (32 pts), loops 2 (4 pts), boolean chains 3 (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 · Matrices.migration_h (cognitive 39) · ×1
  • Matrices.migration_h (cognitive 39) moments/LD/Matrices.py:367 — Matrices.migration_h has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (17 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 · Spectrum.integrate (cognitive 38) · ×1
  • Spectrum.integrate (cognitive 38) REDACTED:672 — Spectrum.integrate has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 9 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Jackknife.closest_ijk_sides (cognitive 38) · ×1
  • Jackknife.closest_ijk_sides (cognitive 38) REDACTED:141 — Jackknife.closest_ijk_sides has cognitive complexity 38 (threshold 15). Drivers by points: loops 12 (28 pts), if/else 6, boolean chains 4 (nesting depth added 16). 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 · Parsing._call_sgc (cognitive 37) · ×1
  • Parsing._call_sgc (cognitive 37) moments/LD/Parsing.py:790 — Parsing._call_sgc has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (37 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parsing.subset_data (cognitive 36) · ×1
  • Parsing.subset_data (cognitive 36) moments/LD/Parsing.py:1504 — Parsing.subset_data has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 4 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes._get_demographic_events (cognitive 35) · ×1
  • Demes._get_demographic_events (cognitive 35) moments/Demes/Demes.py:745 — Demes._get_demographic_events has cognitive complexity 35 (threshold 15). Drivers by points: loops 16 (22 pts), if/else 6 (10 pts), boolean chains 3 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Plotting.plot_4d_comp_Poisson (cognitive 35) · ×1
  • Plotting.plot_4d_comp_Poisson (cognitive 35) moments/Plotting.py:997 — Plotting.plot_4d_comp_Poisson has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numerics.drift (cognitive 33) · ×1
  • Numerics.drift (cognitive 33) moments/Triallele/Numerics.py:57 — Numerics.drift has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (26 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Util.ld_names (cognitive 31) · ×1
  • Util.ld_names (cognitive 31) moments/LD/Util.py:22 — Util.ld_names has cognitive complexity 31 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 2 (10 pts), boolean chains 2 (nesting depth added 18). 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 · Util._compute_S (cognitive 31) · ×1
  • Util._compute_S (cognitive 31) moments/TwoLocus/Util.py:106 — Util._compute_S has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (14 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DemesUtil.slice (cognitive 30) · ×1
  • DemesUtil.slice (cognitive 30) moments/Demes/DemesUtil.py:6 — DemesUtil.slice has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numerics.steady_state (cognitive 30) · ×1
  • Numerics.steady_state (cognitive 30) moments/LD/Numerics.py:380 — Numerics.steady_state has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plotting.plot_3d_comp_Poisson (cognitive 30) · ×1
  • Plotting.plot_3d_comp_Poisson (cognitive 30) moments/Plotting.py:634 — Plotting.plot_3d_comp_Poisson has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (26 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes.LDdecay (cognitive 28) · ×1
  • Demes.LDdecay (cognitive 28) moments/Demes/Demes.py:543 — Demes.LDdecay has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference.uncerts_LD (cognitive 28) · ×1
  • Inference.uncerts_LD (cognitive 28) moments/Demes/Inference.py:1258 — Inference.uncerts_LD has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LDstats.integrate (cognitive 28) · ×1
  • LDstats.integrate (cognitive 28) REDACTED:961 — LDstats.integrate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Matrices.mutation_h (cognitive 28) · ×1
  • Matrices.mutation_h (cognitive 28) moments/LD/Matrices.py:234 — Matrices.mutation_h has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parsing.get_genotypes (cognitive 27) · ×1
  • Parsing.get_genotypes (cognitive 27) moments/LD/Parsing.py:98 — Parsing.get_genotypes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 2 (3 pts), error handling 2, loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ModelInfo.determine_framesizes (cognitive 27) · ×1
  • _ModelInfo.determine_framesizes (cognitive 27) moments/ModelPlot.py:636 — _ModelInfo.determine_framesizes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (10 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.f3 (cognitive 27) · ×1
  • Spectrum.f3 (cognitive 27) REDACTED:1134 — Spectrum.f3 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numerics.recombination (cognitive 27) · ×1
  • Numerics.recombination (cognitive 27) moments/TwoLocus/Numerics.py:311 — Numerics.recombination has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (20 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numerics.selection_two_locus (cognitive 27) · ×1
  • Numerics.selection_two_locus (cognitive 27) moments/TwoLocus/Numerics.py:375 — Numerics.selection_two_locus has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (20 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Numerics.selection_general) 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 · Numerics.selection_general (cognitive 27) · ×1
  • Numerics.selection_general (cognitive 27) moments/TwoLocus/Numerics.py:459 — Numerics.selection_general has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (20 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Numerics.selection_two_locus) 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 · Matrices.recombination (cognitive 26) · ×1
  • Matrices.recombination (cognitive 26) moments/LD/Matrices.py:322 — Matrices.recombination has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parsing._get_ld_stat_sums (cognitive 26) · ×1
  • Parsing._get_ld_stat_sums (cognitive 26) moments/LD/Parsing.py:966 — Parsing._get_ld_stat_sums has cognitive complexity 26 (threshold 15). Drivers by points: loops 7 (17 pts), if/else 4 (9 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Spectrum.__new__ (cognitive 26) · ×1
  • Spectrum.__new__ (cognitive 26) REDACTED:78 — Spectrum.__new__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.f4 (cognitive 26) · ×1
  • Spectrum.f4 (cognitive 26) REDACTED:1206 — Spectrum.f4 has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes._apply_event (cognitive 25) · ×1
  • Demes._apply_event (cognitive 25) moments/Demes/Demes.py:1321 — Demes._apply_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Integration._apply_frozen_pops (cognitive 25) · ×1
  • Integration._apply_frozen_pops (cognitive 25) REDACTED:845 — Integration._apply_frozen_pops has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LDstats.to_file (cognitive 25) · ×1
  • LDstats.to_file (cognitive 25) REDACTED:671 — LDstats.to_file has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 8 (12 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Inference._perturb_params_constrained (cognitive 24) · ×1
  • Inference._perturb_params_constrained (cognitive 24) moments/Demes/Inference.py:280 — Inference._perturb_params_constrained has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plotting.plot_ld_curves (cognitive 24) · ×1
  • Plotting.plot_ld_curves (cognitive 24) moments/LD/Plotting.py:23 — Plotting.plot_ld_curves has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Misc.make_fux_table (cognitive 23) · ×1
  • Misc.make_fux_table (cognitive 23) moments/Misc.py:152 — Misc.make_fux_table has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 3 (7 pts) (nesting depth added 14). 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 · Parsing.get_bootstrap_sets (cognitive 22) · ×1
  • Parsing.get_bootstrap_sets (cognitive 22) moments/LD/Parsing.py:1372 — Parsing.get_bootstrap_sets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (9 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 · Numerics.project (cognitive 22) · ×1
  • Numerics.project (cognitive 22) moments/Triallele/Numerics.py:275 — Numerics.project has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TriSpectrum.fold_ancestral (cognitive 22) · ×1
  • TriSpectrum.fold_ancestral (cognitive 22) REDACTED:346 — TriSpectrum.fold_ancestral has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numerics.mutations_reversible (cognitive 22) · ×1
  • Numerics.mutations_reversible (cognitive 22) moments/TwoLocus/Numerics.py:886 — Numerics.mutations_reversible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 3 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Numerics.recombination_reversible) 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 · Numerics.recombination_reversible (cognitive 22) · ×1
  • Numerics.recombination_reversible (cognitive 22) moments/TwoLocus/Numerics.py:1088 — Numerics.recombination_reversible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 3 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Numerics.mutations_reversible) 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 · DemesUtil.swipe (cognitive 21) · ×1
  • DemesUtil.swipe (cognitive 21) moments/Demes/DemesUtil.py:97 — DemesUtil.swipe has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference.optimize (cognitive 21) · ×1
  • Inference.optimize (cognitive 21) moments/Demes/Inference.py:419 — Inference.optimize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Plotting.plot_2d_comp_Poisson (cognitive 21) · ×1
  • Plotting.plot_2d_comp_Poisson (cognitive 21) moments/Plotting.py:439 — Plotting.plot_2d_comp_Poisson has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Reversible._calc_FB_5pop (cognitive 21) · ×1
  • Reversible._calc_FB_5pop (cognitive 21) moments/Reversible.py:161 — Reversible._calc_FB_5pop has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 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 · Numerics.project (cognitive 21) · ×1
  • Numerics.project (cognitive 21) moments/TwoLocus/Numerics.py:836 — Numerics.project has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 4 (8 pts) (nesting depth added 12). 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 · Inference._object_func (cognitive 20) · ×1
  • Inference._object_func (cognitive 20) moments/Inference.py:25 — Inference._object_func has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LDstats.swap_pops (cognitive 20) · ×1
  • LDstats.swap_pops (cognitive 20) REDACTED:384 — LDstats.swap_pops has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Plotting.plot_single_2d_sfs (cognitive 20) · ×1
  • Plotting.plot_single_2d_sfs (cognitive 20) moments/Plotting.py:201 — Plotting.plot_single_2d_sfs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), error handling 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Demes._migration_rate_in_interval (cognitive 19) · ×1
  • Demes._migration_rate_in_interval (cognitive 19) moments/Demes/Demes.py:978 — Demes._migration_rate_in_interval has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Demes._compute_LD (cognitive 19) · ×1
  • Demes._compute_LD (cognitive 19) moments/Demes/Demes.py:1535 — Demes._compute_LD has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Util.rescale_params (cognitive 19) · ×1
  • Util.rescale_params (cognitive 19) moments/LD/Util.py:150 — Util.rescale_params has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Parsing._check_anc (cognitive 19) · ×1
  • Parsing._check_anc (cognitive 19) moments/Parsing.py:758 — Parsing._check_anc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (19 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Spectrum.f2 (cognitive 19) · ×1
  • Spectrum.f2 (cognitive 19) REDACTED:1080 — Spectrum.f2 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.from_data_dict (cognitive 19) · ×1
  • Spectrum.from_data_dict (cognitive 19) REDACTED:1621 — Spectrum.from_data_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference._object_func (cognitive 19) · ×1
  • Inference._object_func (cognitive 19) moments/TwoLocus/Inference.py:129 — Inference._object_func has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Integration._make_array_sel_dom (cognitive 18) · ×1
  • Integration._make_array_sel_dom (cognitive 18) REDACTED:772 — Integration._make_array_sel_dom has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (18 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Parsing._get_H_statistics (cognitive 18) · ×1
  • Parsing._get_H_statistics (cognitive 18) moments/LD/Parsing.py:1014 — Parsing._get_H_statistics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manips.admix_inplace (cognitive 18) · ×1
  • Manips.admix_inplace (cognitive 18) moments/Manips.py:816 — Manips.admix_inplace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Parsing._spectrum_from_tally (cognitive 18) · ×1
  • Parsing._spectrum_from_tally (cognitive 18) moments/Parsing.py:991 — Parsing._spectrum_from_tally has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.marginalize (cognitive 18) · ×1
  • Spectrum.marginalize (cognitive 18) REDACTED:334 — Spectrum.marginalize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Numerics.cached_projection (cognitive 18) · ×1
  • Numerics.cached_projection (cognitive 18) moments/TwoLocus/Numerics.py:785 — Numerics.cached_projection has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 2 (7 pts), boolean chains 1, error handling 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Inference.optimize_log_lbfgsb (cognitive 17) · ×1
  • Inference.optimize_log_lbfgsb (cognitive 17) moments/LD/Inference.py:810 — Inference.optimize_log_lbfgsb has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · stats_from_genotype_counts.pi2 (cognitive 17) · ×1
  • stats_from_genotype_counts.pi2 (cognitive 17) moments/LD/stats_from_genotype_counts.py:468 — stats_from_genotype_counts.pi2 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Plotting.plot_2d_resid (cognitive 17) · ×1
  • Plotting.plot_2d_resid (cognitive 17) moments/Plotting.py:300 — Plotting.plot_2d_resid has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Reversible._calc_FB_4pop (cognitive 17) · ×1
  • Reversible._calc_FB_4pop (cognitive 17) moments/Reversible.py:94 — Reversible._calc_FB_4pop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.from_file (cognitive 17) · ×1
  • Spectrum.from_file (cognitive 17) REDACTED:1415 — Spectrum.from_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TLSpectrum.fold (cognitive 17) · ×1
  • TLSpectrum.fold (cognitive 17) REDACTED:389 — TLSpectrum.fold has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inference.uncerts (cognitive 16) · ×1
  • Inference.uncerts (cognitive 16) moments/Demes/Inference.py:672 — Inference.uncerts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LDstats.f3 (cognitive 16) · ×1
  • LDstats.f3 (cognitive 16) REDACTED:188 — LDstats.f3 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LDstats.f4) 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 · LDstats.f4 (cognitive 16) · ×1
  • LDstats.f4 (cognitive 16) REDACTED:234 — LDstats.f4 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LDstats.f3) 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 · Parsing.compute_ld_statistics (cognitive 16) · ×1
  • Parsing.compute_ld_statistics (cognitive 16) moments/LD/Parsing.py:1203 — Parsing.compute_ld_statistics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Spectrum.genotype_matrix (cognitive 16) · ×1
  • Spectrum.genotype_matrix (cognitive 16) REDACTED:1346 — Spectrum.genotype_matrix has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (8 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · TooManyMethods · ×1
  • TooManyMethods: Spectrum REDACTED:35 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D35 · Change Coupling · Change coupling · ×1
  • Change coupling: REDACTED ↔ REDACTED REDACTED:1 — `REDACTED` and `REDACTED` 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `cc93eb0e` Bump to 1.1.18; `b70fdcbf` extension docstrings; `00f30240` fix twolocus, triallele — run `git show` on any of them.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (3 members, 38 shared lines) · ×1
  • Near-duplicate member family (3 members, 38 shared lines) REDACTED:905 — REDACTED:905-1196 | REDACTED:417-641 | REDACTED:656-810 — These 3 members are variants of one another: a block of 38 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (115 shared lines) · ×1
  • Near-duplicate member pair (115 shared lines) moments/Plotting.py:647 — moments/Plotting.py:647-800 | moments/Plotting.py:1010-1177 — These two members are variants of one another: 115 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 (104 shared lines) · ×1
  • Near-duplicate member pair (104 shared lines) REDACTED:414 — REDACTED:414-541 | REDACTED:545-799 — These two members are variants of one another: 104 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 (59 shared lines) · ×1
  • Near-duplicate member pair (59 shared lines) REDACTED:143 — REDACTED:143-264 | REDACTED:269-392 — These two members are variants of one another: 59 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 (52 shared lines) · ×1
  • Near-duplicate member pair (52 shared lines) moments/Godambe.py:12 — moments/Godambe.py:12-83 | moments/LD/Godambe.py:21-102 — These two members are variants of one another: 52 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 (49 shared lines) · ×1
  • Near-duplicate member pair (49 shared lines) moments/LinearSystem.py:107 — moments/LinearSystem.py:107-174 | moments/LinearSystem.py:181-257 — These two members are variants of one another: 49 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 (30 shared lines) · ×1
  • Near-duplicate member pair (30 shared lines) moments/Triallele/Jackknife.py:22 — moments/Triallele/Jackknife.py:22-57 | moments/Triallele/Jackknife.py:82-117 — These two members are variants of one another: 30 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 (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) REDACTED:189 — REDACTED:189-232 | REDACTED:235-280 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) moments/TwoLocus/Numerics.py:69 — moments/TwoLocus/Numerics.py:69-240 | moments/TwoLocus/Numerics.py:312-372 | moments/TwoLocus/Numerics.py:376-456 | moments/TwoLocus/Numerics.py:460-774 | moments/TwoLocus/Numerics.py:961-1085 | moments/TwoLocus/Numerics.py:1089-1166 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Duplicated block (117–138 lines × 2) · ×1
  • Duplicated block (117–138 lines × 2) moments/LD/Inference.py:635 — moments/LD/Inference.py:635-751 | moments/LD/Inference.py:837-974 — both copies are in the same file, so extract the 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 (118 lines × 2) · ×1
  • Duplicated block (118 lines × 2) moments/TwoLocus/Numerics.py:123 — moments/TwoLocus/Numerics.py:123-240 | moments/TwoLocus/Numerics.py:968-1085 — both copies are in the same file, so extract the 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 (90–92 lines × 2) · ×1
  • Duplicated block (90–92 lines × 2) moments/Inference.py:238 — moments/Inference.py:238-327 | moments/Inference.py:1068-1159 — both copies are in the same file, so extract the 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 `moments/Inference.py:1068` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/Inference.py:329` calls `log` and `moments/Inference.py:1160` 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 (49–79 lines × 2) · ×1
  • Duplicated block (49–79 lines × 2) moments/LinearSystem.py:321 — moments/LinearSystem.py:321-369 | moments/LinearSystem.py:372-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (72 lines × 3) · ×1
  • Duplicated block (72 lines × 3) moments/Inference.py:114 — moments/Inference.py:114-196 | moments/Inference.py:723-802 | moments/Inference.py:955-1026 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Inference.py:955` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (67 lines × 2) · ×1
  • Duplicated block (67 lines × 2) moments/Inference.py:614 — moments/Inference.py:614-680 | moments/Inference.py:848-915 — both copies are in the same file, so extract the 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 `moments/Inference.py:848` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (63 lines × 2) · ×1
  • Duplicated block (63 lines × 2) moments/Demes/Inference.py:532 — moments/Demes/Inference.py:532-594 | moments/Demes/Inference.py:1123-1185 — both copies are in the same file, so extract the 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 `moments/Demes/Inference.py:532` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/Demes/Inference.py:595` calls `delayed_flush` and `moments/Demes/Inference.py:1186` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–60 lines × 2) · ×1
  • Duplicated block (14–60 lines × 2) moments/Demes/Inference.py:435 — moments/Demes/Inference.py:435-494 | moments/Demes/Inference.py:746-759 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (58 lines × 2) · ×1
  • Duplicated block (58 lines × 2) moments/LD/Matrices.py:1555 — moments/LD/Matrices.py:1555-1612 | moments/LD/Matrices.py:1632-1689 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:1555` 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 (57 lines × 3) · ×1
  • Duplicated block (57 lines × 3) moments/LD/Inference.py:534 — moments/LD/Inference.py:534-590 | moments/LD/Inference.py:735-791 | moments/LD/Inference.py:958-1014 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Inference.py:534` 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 (48 lines × 5) · ×1
  • Duplicated block (48 lines × 5) moments/LD/Matrices.py:1984 — moments/LD/Matrices.py:1984-2031 | moments/LD/Matrices.py:2041-2088 | moments/LD/Matrices.py:2098-2145 | moments/LD/Matrices.py:2155-2202 | moments/LD/Matrices.py:2214-2261 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1984` 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 (42–43 lines × 2) · ×1
  • Duplicated block (42–43 lines × 2) moments/Plotting.py:752 — moments/Plotting.py:752-793 | moments/Plotting.py:1127-1169 — both copies are in the same file, so extract the 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 (41 lines × 4) · ×1
  • Duplicated block (41 lines × 4) moments/LD/Matrices.py:1787 — moments/LD/Matrices.py:1787-1827 | moments/LD/Matrices.py:1836-1876 | moments/LD/Matrices.py:1885-1925 | moments/LD/Matrices.py:1934-1974 — 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 (31–41 lines × 2) · ×1
  • Duplicated block (31–41 lines × 2) moments/Manips.py:714 — moments/Manips.py:714-754 | moments/Manips.py:817-847 — both copies are in the same file, so extract the 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–40 lines × 2) · ×1
  • Duplicated block (27–40 lines × 2) REDACTED:250 — REDACTED:250-289 | REDACTED:342-368 — 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 (37–39 lines × 3) · ×1
  • Duplicated block (37–39 lines × 3) moments/Plotting.py:452 — moments/Plotting.py:452-490 | moments/Plotting.py:647-683 | moments/Plotting.py:1010-1046 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Plotting.py:452` 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 (26–37 lines × 4) · ×1
  • Duplicated block (26–37 lines × 4) moments/Godambe.py:223 — moments/Godambe.py:223-259 | moments/Godambe.py:269-299 | moments/Godambe.py:305-335 | moments/Godambe.py:480-505 — 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 (34–35 lines × 2) · ×1
  • Duplicated block (34–35 lines × 2) moments/Plotting.py:263 — moments/Plotting.py:263-297 | moments/Plotting.py:345-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–34 lines × 8) · ×1
  • Duplicated block (26–34 lines × 8) moments/LD/Matrices.py:1454 — moments/LD/Matrices.py:1454-1479 | moments/LD/Matrices.py:1482-1507 | moments/LD/Matrices.py:1538-1563 | moments/LD/Matrices.py:1615-1640 | moments/LD/Matrices.py:3039-3072 | moments/LD/Matrices.py:3075-3108 | moments/LD/Matrices.py:3147-3180 | moments/LD/Matrices.py:3183-3216 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (26–34 lines × 7) · ×1
  • Duplicated block (26–34 lines × 7) moments/LD/Matrices.py:1510 — moments/LD/Matrices.py:1510-1535 | moments/LD/Matrices.py:1692-1717 | moments/LD/Matrices.py:3111-3144 | moments/LD/Matrices.py:3219-3252 | moments/LD/Matrices.py:3255-3288 | moments/LD/Matrices.py:3291-3324 | moments/LD/Matrices.py:3327-3360 — all 7 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 (29–34 lines × 3) · ×1
  • Duplicated block (29–34 lines × 3) moments/Reversible.py:62 — moments/Reversible.py:62-90 | moments/Reversible.py:125-157 | moments/Reversible.py:205-238 — 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 (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) moments/LD/Matrices.py:3999 — moments/LD/Matrices.py:3999-4030 | moments/LD/Matrices.py:4756-4787 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:3999` 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 (30 lines × 4) · ×1
  • Duplicated block (30 lines × 4) moments/LD/Matrices.py:3445 — moments/LD/Matrices.py:3445-3474 | moments/LD/Matrices.py:3653-3682 | moments/LD/Matrices.py:4202-4231 | moments/LD/Matrices.py:4410-4439 — 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 `moments/LD/Matrices.py:3445` 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 (22–29 lines × 5) · ×1
  • Duplicated block (22–29 lines × 5) REDACTED:599 — REDACTED:599-623 | moments/Numerics.py:139-167 | REDACTED:1416-1444 | REDACTED:185-208 | REDACTED:291-312 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:599` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–28 lines × 11) · ×1
  • Duplicated block (22–28 lines × 11) moments/LD/Matrices.py:2452 — moments/LD/Matrices.py:2452-2473 | moments/LD/Matrices.py:3571-3598 | moments/LD/Matrices.py:3779-3806 | moments/LD/Matrices.py:3859-3886 | moments/LD/Matrices.py:3939-3966 | moments/LD/Matrices.py:4019-4046 | moments/LD/Matrices.py:4328-4355 | moments/LD/Matrices.py:4536-4563 | moments/LD/Matrices.py:4616-4643 | moments/LD/Matrices.py:4696-4723 | moments/LD/Matrices.py:4776-4803 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2452` 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 (22–28 lines × 10) · ×1
  • Duplicated block (22–28 lines × 10) moments/LD/Matrices.py:2340 — moments/LD/Matrices.py:2340-2361 | moments/LD/Matrices.py:2388-2409 | moments/LD/Matrices.py:3427-3454 | moments/LD/Matrices.py:3491-3518 | moments/LD/Matrices.py:3635-3662 | moments/LD/Matrices.py:3699-3726 | moments/LD/Matrices.py:4184-4211 | moments/LD/Matrices.py:4248-4275 | moments/LD/Matrices.py:4392-4419 | moments/LD/Matrices.py:4456-4483 — all 10 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 `moments/LD/Matrices.py:2340` 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 (22–28 lines × 5) · ×1
  • Duplicated block (22–28 lines × 5) moments/LD/Matrices.py:1009 — moments/LD/Matrices.py:1009-1030 | moments/LD/Matrices.py:2738-2765 | moments/LD/Matrices.py:2768-2795 | moments/LD/Matrices.py:2828-2855 | moments/LD/Matrices.py:2858-2885 — 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.
D4 · Code Duplication · Duplicated block (22–28 lines × 3) · ×1
  • Duplicated block (22–28 lines × 3) moments/LD/Matrices.py:2490 — moments/LD/Matrices.py:2490-2511 | moments/LD/Matrices.py:2563-2590 | moments/LD/Matrices.py:2621-2648 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) moments/LD/Matrices.py:2997 — moments/LD/Matrices.py:2997-3024 | moments/LD/Matrices.py:3353-3379 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:2997` 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 (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) moments/LD/Godambe.py:106 — moments/LD/Godambe.py:106-132 | moments/LD/Godambe.py:146-171 — both copies are in the same file, so extract the 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 (24–27 lines × 2) · ×1
  • Duplicated block (24–27 lines × 2) moments/Misc.py:800 — moments/Misc.py:800-823 | REDACTED:1665-1691 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26 lines × 5) · ×1
  • Duplicated block (26 lines × 5) moments/LD/Matrices.py:2800 — moments/LD/Matrices.py:2800-2825 | moments/LD/Matrices.py:2890-2915 | moments/LD/Matrices.py:2920-2945 | moments/LD/Matrices.py:2950-2975 | moments/LD/Matrices.py:2980-3005 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2800` 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 (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) moments/Demes/Inference.py:369 — moments/Demes/Inference.py:369-394 | moments/Demes/Inference.py:816-841 — both copies are in the same file, so extract the 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 (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) moments/Demes/Inference.py:964 — moments/Demes/Inference.py:964-986 | moments/Demes/Inference.py:1330-1354 — both copies are in the same file, so extract the 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 (22–23 lines × 6) · ×1
  • Duplicated block (22–23 lines × 6) moments/LD/Matrices.py:2907 — moments/LD/Matrices.py:2907-2929 | moments/LD/Matrices.py:2937-2959 | moments/LD/Matrices.py:2967-2989 | moments/LD/Matrices.py:3245-3266 | moments/LD/Matrices.py:3281-3302 | moments/LD/Matrices.py:3317-3338 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2907` 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 (23 lines × 4) · ×1
  • Duplicated block (23 lines × 4) REDACTED:555 — REDACTED:555-577 | REDACTED:618-640 | REDACTED:681-703 | REDACTED:744-766 — 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 `REDACTED:555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–22 lines × 6) · ×1
  • Duplicated block (20–22 lines × 6) moments/LD/Matrices.py:1270 — moments/LD/Matrices.py:1270-1289 | moments/LD/Matrices.py:1978-1999 | moments/LD/Matrices.py:2035-2056 | moments/LD/Matrices.py:2092-2113 | moments/LD/Matrices.py:2149-2170 | moments/LD/Matrices.py:2208-2229 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1270` 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 (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) REDACTED:560 — REDACTED:560-581 | REDACTED:749-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. The matched lines also transfer control out of the body holding them, 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 (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) moments/LD/Matrices.py:2817 — moments/LD/Matrices.py:2817-2838 | moments/LD/Matrices.py:3137-3157 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:2817` 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 (21 lines × 10) · ×1
  • Duplicated block (21 lines × 10) moments/LD/Matrices.py:2793 — moments/LD/Matrices.py:2793-2813 | moments/LD/Matrices.py:2883-2903 | moments/LD/Matrices.py:2913-2933 | moments/LD/Matrices.py:2943-2963 | moments/LD/Matrices.py:2973-2993 | moments/LD/Matrices.py:3106-3126 | moments/LD/Matrices.py:3214-3234 | moments/LD/Matrices.py:3250-3270 | moments/LD/Matrices.py:3286-3306 | moments/LD/Matrices.py:3322-3342 — all 10 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 `moments/LD/Matrices.py:2793` 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 (21 lines × 8) · ×1
  • Duplicated block (21 lines × 8) moments/LD/Matrices.py:3401 — moments/LD/Matrices.py:3401-3421 | moments/LD/Matrices.py:3465-3485 | moments/LD/Matrices.py:3609-3629 | moments/LD/Matrices.py:3673-3693 | moments/LD/Matrices.py:4158-4178 | moments/LD/Matrices.py:4222-4242 | moments/LD/Matrices.py:4366-4386 | moments/LD/Matrices.py:4430-4450 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:3401` 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 (21 lines × 4) · ×1
  • Duplicated block (21 lines × 4) moments/Inference.py:176 — moments/Inference.py:176-196 | moments/Inference.py:782-802 | moments/Inference.py:1006-1026 | moments/TwoLocus/Inference.py:222-242 — before extracting anything, compare `moments/Inference.py` and `moments/TwoLocus/Inference.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 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 (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) REDACTED:106 — REDACTED:106-126 | REDACTED:58-75 — 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 `REDACTED:106` 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 (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) moments/TwoLocus/Numerics.py:387 — moments/TwoLocus/Numerics.py:387-406 | moments/TwoLocus/Numerics.py:493-513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–20 lines × 10) · ×1
  • Duplicated block (18–20 lines × 10) moments/LD/Matrices.py:1990 — moments/LD/Matrices.py:1990-2009 | moments/LD/Matrices.py:2047-2066 | moments/LD/Matrices.py:2104-2123 | moments/LD/Matrices.py:2161-2180 | moments/LD/Matrices.py:2220-2239 | moments/LD/Matrices.py:2807-2824 | moments/LD/Matrices.py:2897-2914 | moments/LD/Matrices.py:2927-2944 | moments/LD/Matrices.py:2957-2974 | moments/LD/Matrices.py:2987-3004 — all 10 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 `moments/LD/Matrices.py:1990` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) moments/LD/Godambe.py:405 — moments/LD/Godambe.py:405-424 | moments/LD/Godambe.py:502-521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Godambe.py:405` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×1
  • Duplicated block (18–20 lines × 2) moments/LD/Matrices.py:2277 — moments/LD/Matrices.py:2277-2296 | moments/LD/Matrices.py:3017-3034 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:2277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (19 lines × 8) · ×1
  • Duplicated block (19 lines × 8) moments/LD/Matrices.py:4041 — moments/LD/Matrices.py:4041-4059 | moments/LD/Matrices.py:4061-4079 | moments/LD/Matrices.py:4081-4099 | moments/LD/Matrices.py:4101-4119 | moments/LD/Matrices.py:4798-4816 | moments/LD/Matrices.py:4818-4836 | moments/LD/Matrices.py:4838-4856 | moments/LD/Matrices.py:4858-4876 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:4041` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–19 lines × 3) · ×1
  • Duplicated block (14–19 lines × 3) moments/Triallele/Numerics.py:413 — moments/Triallele/Numerics.py:413-427 | moments/Triallele/Numerics.py:475-488 | moments/Triallele/Numerics.py:531-549 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Triallele/Numerics.py:413` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) moments/TwoLocus/Numerics.py:312 — moments/TwoLocus/Numerics.py:312-330 | moments/TwoLocus/Numerics.py:1089-1105 — both copies are in the same file, so extract the 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–18 lines × 45) · ×1
  • Duplicated block (14–18 lines × 45) moments/LD/Matrices.py:1974 — moments/LD/Matrices.py:1974-1987 | moments/LD/Matrices.py:2031-2044 | moments/LD/Matrices.py:2088-2101 | moments/LD/Matrices.py:2145-2158 | moments/LD/Matrices.py:2350-2363 | moments/LD/Matrices.py:2398-2411 | moments/LD/Matrices.py:2414-2427 | moments/LD/Matrices.py:2430-2443 | moments/LD/Matrices.py:2446-2459 | moments/LD/Matrices.py:3441-3458 | moments/LD/Matrices.py:3505-3522 | moments/LD/Matrices.py:3525-3542 | moments/LD/Matrices.py:3545-3562 | moments/LD/Matrices.py:3565-3582 | moments/LD/Matrices.py:3649-3666 | moments/LD/Matrices.py:3713-3730 | moments/LD/Matrices.py:3733-3750 | moments/LD/Matrices.py:3753-3770 | moments/LD/Matrices.py:3773-3790 | moments/LD/Matrices.py:3813-3830 | moments/LD/Matrices.py:3833-3850 | moments/LD/Matrices.py:3853-3870 | moments/LD/Matrices.py:3893-3910 | moments/LD/Matrices.py:3913-3930 | moments/LD/Matrices.py:3933-3950 | moments/LD/Matrices.py:3973-3990 | moments/LD/Matrices.py:3993-4010 | moments/LD/Matrices.py:4198-4215 | moments/LD/Matrices.py:4262-4279 | moments/LD/Matrices.py:4282-4299 | moments/LD/Matrices.py:4302-4319 | moments/LD/Matrices.py:4322-4339 | moments/LD/Matrices.py:4406-4423 | moments/LD/Matrices.py:4470-4487 | moments/LD/Matrices.py:4490-4507 | moments/LD/Matrices.py:4510-4527 | moments/LD/Matrices.py:4530-4547 | moments/LD/Matrices.py:4570-4587 | moments/LD/Matrices.py:4590-4607 | moments/LD/Matrices.py:4610-4627 | moments/LD/Matrices.py:4650-4667 | moments/LD/Matrices.py:4670-4687 | moments/LD/Matrices.py:4690-4707 | moments/LD/Matrices.py:4730-4747 | moments/LD/Matrices.py:4750-4767 — all 45 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 `moments/LD/Matrices.py:1974` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–18 lines × 9) · ×1
  • Duplicated block (14–18 lines × 9) moments/LD/Matrices.py:1016 — moments/LD/Matrices.py:1016-1029 | moments/LD/Matrices.py:1794-1809 | moments/LD/Matrices.py:1843-1858 | moments/LD/Matrices.py:1892-1907 | moments/LD/Matrices.py:1941-1956 | moments/LD/Matrices.py:2747-2764 | moments/LD/Matrices.py:2777-2794 | moments/LD/Matrices.py:2837-2854 | moments/LD/Matrices.py:2867-2884 — all 9 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 `moments/LD/Matrices.py:1016` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–18 lines × 7) · ×1
  • Duplicated block (14–18 lines × 7) moments/LD/Matrices.py:1380 — moments/LD/Matrices.py:1380-1393 | moments/LD/Matrices.py:1565-1578 | moments/LD/Matrices.py:1642-1655 | moments/LD/Matrices.py:2498-2511 | moments/LD/Matrices.py:2514-2527 | moments/LD/Matrices.py:2573-2590 | moments/LD/Matrices.py:2631-2648 — all 7 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 `moments/LD/Matrices.py:1380` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 6) · ×1
  • Duplicated block (18 lines × 6) moments/LD/Matrices.py:2679 — moments/LD/Matrices.py:2679-2696 | moments/LD/Matrices.py:2798-2815 | moments/LD/Matrices.py:2888-2905 | moments/LD/Matrices.py:2918-2935 | moments/LD/Matrices.py:2948-2965 | moments/LD/Matrices.py:2978-2995 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:2679` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) REDACTED:807 — REDACTED:807-824 | REDACTED:826-843 | REDACTED:845-862 | REDACTED:864-881 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `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 (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) moments/Triallele/Integration.py:59 — moments/Triallele/Integration.py:59-75 | moments/Triallele/Integration.py:101-118 — both copies are in the same file, so extract the 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–17 lines × 4) · ×1
  • Duplicated block (14–17 lines × 4) moments/LD/Matrices.py:2529 — moments/LD/Matrices.py:2529-2543 | moments/LD/Matrices.py:2545-2558 | moments/LD/Matrices.py:2601-2617 | moments/LD/Matrices.py:2659-2675 — 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 `moments/LD/Matrices.py:2529` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) moments/Demes/Demes.py:1085 — moments/Demes/Demes.py:1085-1098 | moments/Demes/Demes.py:1100-1116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×1
  • Duplicated block (17 lines × 2) moments/Godambe.py:139 — moments/Godambe.py:139-155 | moments/LD/Godambe.py:178-194 — 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 (16 lines × 8) · ×1
  • Duplicated block (16 lines × 8) moments/LD/Matrices.py:1778 — moments/LD/Matrices.py:1778-1793 | moments/LD/Matrices.py:1827-1842 | moments/LD/Matrices.py:1876-1891 | moments/LD/Matrices.py:1925-1940 | moments/LD/Matrices.py:2318-2333 | moments/LD/Matrices.py:2334-2349 | moments/LD/Matrices.py:2366-2381 | moments/LD/Matrices.py:2382-2397 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1778` 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–16 lines × 5) · ×1
  • Duplicated block (15–16 lines × 5) moments/LD/Matrices.py:1095 — moments/LD/Matrices.py:1095-1110 | moments/LD/Matrices.py:1112-1126 | moments/LD/Matrices.py:1144-1158 | moments/LD/Matrices.py:2505-2519 | moments/LD/Matrices.py:2537-2551 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1095` 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 (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) moments/TwoLocus/Util.py:504 — moments/TwoLocus/Util.py:504-519 | moments/TwoLocus/Util.py:527-542 | moments/TwoLocus/Util.py:550-565 | moments/TwoLocus/Util.py:573-588 — 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 (15–16 lines × 3) · ×1
  • Duplicated block (15–16 lines × 3) REDACTED:1067 — REDACTED:1067-1082 | REDACTED:551-565 | REDACTED:739-754 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:566` calls `any`, `ValueError` and `REDACTED:1083` 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 (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) moments/LD/Matrices.py:1063 — moments/LD/Matrices.py:1063-1077 | moments/LD/Matrices.py:1087-1102 — both copies are in the same file, so extract the 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 `moments/LD/Matrices.py:1063` 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 lines × 19) · ×1
  • Duplicated block (15 lines × 19) moments/LD/Matrices.py:2459 — moments/LD/Matrices.py:2459-2473 | moments/LD/Matrices.py:3581-3599 | moments/LD/Matrices.py:3789-3807 | moments/LD/Matrices.py:3869-3887 | moments/LD/Matrices.py:3949-3967 | moments/LD/Matrices.py:4029-4047 | moments/LD/Matrices.py:4049-4067 | moments/LD/Matrices.py:4069-4087 | moments/LD/Matrices.py:4089-4107 | moments/LD/Matrices.py:4109-4127 | moments/LD/Matrices.py:4338-4356 | moments/LD/Matrices.py:4546-4564 | moments/LD/Matrices.py:4626-4644 | moments/LD/Matrices.py:4706-4724 | moments/LD/Matrices.py:4786-4804 | moments/LD/Matrices.py:4806-4824 | moments/LD/Matrices.py:4826-4844 | moments/LD/Matrices.py:4846-4864 | moments/LD/Matrices.py:4866-4884 — all 19 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 `moments/LD/Matrices.py:2459` 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 lines × 6) · ×1
  • Duplicated block (15 lines × 6) moments/LD/Matrices.py:1104 — moments/LD/Matrices.py:1104-1118 | moments/LD/Matrices.py:1120-1134 | moments/LD/Matrices.py:1136-1150 | moments/LD/Matrices.py:1152-1166 | moments/LD/Matrices.py:1395-1409 | moments/LD/Matrices.py:1427-1441 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1104` 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 lines × 3) · ×1
  • Duplicated block (15 lines × 3) moments/Inference.py:1193 — moments/Inference.py:1193-1207 | moments/LD/Inference.py:1051-1065 | moments/TwoLocus/Inference.py:110-124 — before extracting anything, compare `moments/Inference.py` and `moments/TwoLocus/Inference.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–15 lines × 3) · ×1
  • Duplicated block (12–15 lines × 3) moments/Misc.py:283 — moments/Misc.py:283-295 | moments/Misc.py:469-483 | moments/Misc.py:494-505 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Misc.py:283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Misc.py:466` calls `ValueError` and `moments/Misc.py:282` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14 lines × 49) · ×1
  • Duplicated block (14 lines × 49) moments/LD/Matrices.py:1269 — moments/LD/Matrices.py:1269-1282 | moments/LD/Matrices.py:1977-1990 | moments/LD/Matrices.py:2034-2047 | moments/LD/Matrices.py:2091-2104 | moments/LD/Matrices.py:2148-2161 | moments/LD/Matrices.py:2207-2220 | moments/LD/Matrices.py:2353-2366 | moments/LD/Matrices.py:2401-2414 | moments/LD/Matrices.py:2417-2430 | moments/LD/Matrices.py:2433-2446 | moments/LD/Matrices.py:2449-2462 | moments/LD/Matrices.py:3444-3461 | moments/LD/Matrices.py:3508-3525 | moments/LD/Matrices.py:3528-3545 | moments/LD/Matrices.py:3548-3565 | moments/LD/Matrices.py:3568-3585 | moments/LD/Matrices.py:3652-3669 | moments/LD/Matrices.py:3716-3733 | moments/LD/Matrices.py:3736-3753 | moments/LD/Matrices.py:3756-3773 | moments/LD/Matrices.py:3776-3793 | moments/LD/Matrices.py:3816-3833 | moments/LD/Matrices.py:3836-3853 | moments/LD/Matrices.py:3856-3873 | moments/LD/Matrices.py:3896-3913 | moments/LD/Matrices.py:3916-3933 | moments/LD/Matrices.py:3936-3953 | moments/LD/Matrices.py:3976-3993 | moments/LD/Matrices.py:3996-4013 | moments/LD/Matrices.py:4016-4033 | moments/LD/Matrices.py:4201-4218 | moments/LD/Matrices.py:4265-4282 | moments/LD/Matrices.py:4285-4302 | moments/LD/Matrices.py:4305-4322 | moments/LD/Matrices.py:4325-4342 | moments/LD/Matrices.py:4409-4426 | moments/LD/Matrices.py:4473-4490 | moments/LD/Matrices.py:4493-4510 | moments/LD/Matrices.py:4513-4530 | moments/LD/Matrices.py:4533-4550 | moments/LD/Matrices.py:4573-4590 | moments/LD/Matrices.py:4593-4610 | moments/LD/Matrices.py:4613-4630 | moments/LD/Matrices.py:4653-4670 | moments/LD/Matrices.py:4673-4690 | moments/LD/Matrices.py:4693-4710 | moments/LD/Matrices.py:4733-4750 | moments/LD/Matrices.py:4753-4770 | moments/LD/Matrices.py:4773-4790 — all 49 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/LD/Matrices.py:3463` calls `elif` and `moments/LD/Matrices.py:1284` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14 lines × 12) · ×1
  • Duplicated block (14 lines × 12) moments/LD/Matrices.py:2321 — moments/LD/Matrices.py:2321-2334 | moments/LD/Matrices.py:2337-2350 | moments/LD/Matrices.py:2369-2382 | moments/LD/Matrices.py:2385-2398 | moments/LD/Matrices.py:3424-3441 | moments/LD/Matrices.py:3488-3505 | moments/LD/Matrices.py:3632-3649 | moments/LD/Matrices.py:3696-3713 | moments/LD/Matrices.py:4181-4198 | moments/LD/Matrices.py:4245-4262 | moments/LD/Matrices.py:4389-4406 | moments/LD/Matrices.py:4453-4470 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 10) · ×1
  • Duplicated block (14 lines × 10) moments/LD/Matrices.py:1171 — moments/LD/Matrices.py:1171-1184 | moments/LD/Matrices.py:1220-1233 | moments/LD/Matrices.py:1781-1794 | moments/LD/Matrices.py:1830-1843 | moments/LD/Matrices.py:1879-1892 | moments/LD/Matrices.py:1928-1941 | moments/LD/Matrices.py:2321-2334 | moments/LD/Matrices.py:2337-2350 | moments/LD/Matrices.py:2369-2382 | moments/LD/Matrices.py:2385-2398 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 8) · ×1
  • Duplicated block (14 lines × 8) moments/LD/Matrices.py:1009 — moments/LD/Matrices.py:1009-1022 | moments/LD/Matrices.py:2490-2503 | moments/LD/Matrices.py:2563-2580 | moments/LD/Matrices.py:2621-2638 | moments/LD/Matrices.py:2738-2755 | moments/LD/Matrices.py:2768-2785 | moments/LD/Matrices.py:2828-2845 | moments/LD/Matrices.py:2858-2875 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1009` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) moments/Demes/Inference.py:376 — moments/Demes/Inference.py:376-389 | moments/Demes/Inference.py:822-835 | moments/Demes/Inference.py:967-980 | moments/Demes/Inference.py:1333-1346 — 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 (13–14 lines × 4) · ×1
  • Duplicated block (13–14 lines × 4) moments/TwoLocus/Demographics.py:124 — moments/TwoLocus/Demographics.py:124-137 | moments/TwoLocus/Demographics.py:158-170 | moments/TwoLocus/Demographics.py:191-204 | moments/TwoLocus/Demographics.py:226-238 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/TwoLocus/Demographics.py:205` calls `exp`, `log` and `moments/TwoLocus/Demographics.py:138` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–14 lines × 3) · ×1
  • Duplicated block (10–14 lines × 3) REDACTED:980 — REDACTED:980-989 | REDACTED:486-499 | REDACTED:706-719 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:486` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) REDACTED:967 — REDACTED:967-980 | REDACTED:998-1010 | REDACTED:1013-1025 — 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 (3–14 lines × 4) · ×1
  • Duplicated block (3–14 lines × 4) moments/Triallele/Jackknife.py:33 — moments/Triallele/Jackknife.py:33-46 | moments/Triallele/Jackknife.py:47-49 | moments/Triallele/Jackknife.py:93-106 | moments/Triallele/Jackknife.py:107-109 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `moments/Triallele/Jackknife.py:47` calls `array`, `sum` and `moments/Triallele/Jackknife.py:49` 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 (13 lines × 13) · ×1
  • Duplicated block (13 lines × 13) moments/LD/Matrices.py:1510 — moments/LD/Matrices.py:1510-1522 | moments/LD/Matrices.py:1692-1704 | moments/LD/Matrices.py:2679-2695 | moments/LD/Matrices.py:2798-2814 | moments/LD/Matrices.py:2888-2904 | moments/LD/Matrices.py:2918-2934 | moments/LD/Matrices.py:2948-2964 | moments/LD/Matrices.py:2978-2994 | moments/LD/Matrices.py:3111-3127 | moments/LD/Matrices.py:3219-3235 | moments/LD/Matrices.py:3255-3271 | moments/LD/Matrices.py:3291-3307 | moments/LD/Matrices.py:3327-3343 — all 13 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 `moments/LD/Matrices.py:1510` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) moments/LD/Matrices.py:1009 — moments/LD/Matrices.py:1009-1021 | moments/LD/Matrices.py:1323-1335 | moments/LD/Matrices.py:1454-1466 | moments/LD/Matrices.py:1482-1494 | moments/LD/Matrices.py:2490-2502 | moments/LD/Matrices.py:2738-2754 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:1009` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) moments/LD/Parsing.py:869 — moments/LD/Parsing.py:869-881 | moments/LD/Parsing.py:893-905 | moments/LD/Parsing.py:920-932 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Parsing.py:869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) moments/Manips.py:231 — moments/Manips.py:231-242 | moments/Manips.py:294-306 | moments/Manips.py:356-368 — 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 (12 lines × 20) · ×1
  • Duplicated block (12 lines × 20) moments/LD/Matrices.py:2261 — moments/LD/Matrices.py:2261-2272 | moments/LD/Matrices.py:2462-2473 | moments/LD/Matrices.py:3585-3600 | moments/LD/Matrices.py:3793-3808 | moments/LD/Matrices.py:3873-3888 | moments/LD/Matrices.py:3953-3968 | moments/LD/Matrices.py:4033-4048 | moments/LD/Matrices.py:4053-4068 | moments/LD/Matrices.py:4073-4088 | moments/LD/Matrices.py:4093-4108 | moments/LD/Matrices.py:4113-4128 | moments/LD/Matrices.py:4342-4357 | moments/LD/Matrices.py:4550-4565 | moments/LD/Matrices.py:4630-4645 | moments/LD/Matrices.py:4710-4725 | moments/LD/Matrices.py:4790-4805 | moments/LD/Matrices.py:4810-4825 | moments/LD/Matrices.py:4830-4845 | moments/LD/Matrices.py:4850-4865 | moments/LD/Matrices.py:4870-4885 — all 20 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 `moments/LD/Matrices.py:2261` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–12 lines × 14) · ×1
  • Duplicated block (9–12 lines × 14) REDACTED:464 — REDACTED:464-475 | REDACTED:478-489 | REDACTED:492-503 | REDACTED:506-517 | REDACTED:520-531 | REDACTED:532-540 | REDACTED:579-590 | REDACTED:591-602 | REDACTED:642-653 | REDACTED:654-665 | REDACTED:705-716 | REDACTED:717-728 | REDACTED:768-779 | REDACTED:780-791 — all 14 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 `REDACTED:464` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 8) · ×1
  • Duplicated block (12 lines × 8) REDACTED:184 — REDACTED:184-195 | REDACTED:204-215 | REDACTED:224-235 | REDACTED:244-255 | REDACTED:317-328 | REDACTED:334-345 | REDACTED:351-362 | REDACTED:368-379 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) moments/Manips.py:50 — moments/Manips.py:50-61 | moments/Manips.py:104-115 | moments/Manips.py:162-173 | moments/Manips.py:349-360 — 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 × 3) · ×1
  • Duplicated block (11–12 lines × 3) REDACTED:911 — REDACTED:911-922 | REDACTED:926-936 | REDACTED:940-950 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:911` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) moments/Demes/Inference.py:757 — moments/Demes/Inference.py:757-766 | moments/Demes/Inference.py:1304-1315 — both copies are in the same file, so extract the 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 `moments/Demes/Inference.py:1304` 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 (4–12 lines × 5) · ×1
  • Duplicated block (4–12 lines × 5) REDACTED:549 — REDACTED:549-552 | REDACTED:603-614 | REDACTED:666-677 | REDACTED:732-736 | REDACTED:738-741 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:603` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×1
  • Duplicated block (10–11 lines × 4) moments/LD/Parsing.py:849 — moments/LD/Parsing.py:849-859 | moments/LD/Parsing.py:871-880 | moments/LD/Parsing.py:895-904 | moments/LD/Parsing.py:922-931 — 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 `moments/LD/Parsing.py:849` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) moments/LD/stats_from_genotype_counts.py:443 — moments/LD/stats_from_genotype_counts.py:443-453 | moments/LD/stats_from_genotype_counts.py:1228-1238 | moments/LD/stats_from_genotype_counts.py:1269-1279 | moments/LD/stats_from_genotype_counts.py:1325-1335 — 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 `moments/LD/stats_from_genotype_counts.py:443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–10 lines × 16) · ×1
  • Duplicated block (7–10 lines × 16) REDACTED:422 — REDACTED:422-428 | REDACTED:433-442 | REDACTED:444-453 | REDACTED:454-461 | REDACTED:572-581 | REDACTED:584-593 | REDACTED:596-605 | REDACTED:635-644 | REDACTED:647-656 | REDACTED:659-668 | REDACTED:698-707 | REDACTED:710-719 | REDACTED:722-731 | REDACTED:761-770 | REDACTED:773-782 | REDACTED:785-794 — all 16 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 `REDACTED:422` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5–10 lines × 4) · ×1
  • Duplicated block (5–10 lines × 4) moments/Triallele/Numerics.py:415 — moments/Triallele/Numerics.py:415-424 | moments/Triallele/Numerics.py:537-546 | moments/Triallele/Numerics.py:557-561 | moments/Triallele/Numerics.py:585-589 — 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 `moments/Triallele/Numerics.py:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `moments/Triallele/Numerics.py:534` calls `choose` and `moments/Triallele/Numerics.py:412` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–10 lines × 4) · ×1
  • Duplicated block (6–10 lines × 4) moments/LD/Matrices.py:122 — moments/LD/Matrices.py:122-131 | moments/LD/Matrices.py:133-142 | moments/LD/Matrices.py:143-148 | moments/LD/Matrices.py:163-172 — 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. 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, `moments/LD/Matrices.py:133` calls `zip` and `moments/LD/Matrices.py:143` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) moments/Inference.py:76 — moments/Inference.py:76-83 | moments/LD/Inference.py:392-401 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 9) · ×1
  • Duplicated block (9 lines × 9) REDACTED:909 — REDACTED:909-918 | REDACTED:924-932 | REDACTED:938-946 | REDACTED:966-976 | REDACTED:982-991 | REDACTED:997-1006 | REDACTED:1012-1021 | REDACTED:1027-1036 | REDACTED:1042-1051 — all 9 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 (7–9 lines × 6) · ×1
  • Duplicated block (7–9 lines × 6) moments/TwoLocus/Numerics.py:72 — moments/TwoLocus/Numerics.py:72-78 | moments/TwoLocus/Numerics.py:319-326 | moments/TwoLocus/Numerics.py:388-395 | moments/TwoLocus/Numerics.py:494-502 | moments/TwoLocus/Numerics.py:961-967 | moments/TwoLocus/Numerics.py:1094-1101 — 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 (9 lines × 3) · ×1
  • Duplicated block (9 lines × 3) moments/LD/Matrices.py:653 — moments/LD/Matrices.py:653-661 | moments/LD/Matrices.py:714-722 | moments/LD/Matrices.py:734-742 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:653` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) moments/LD/stats_from_genotype_counts.py:1062 — moments/LD/stats_from_genotype_counts.py:1062-1069 | moments/LD/stats_from_genotype_counts.py:1335-1343 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:1062` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 11) · ×1
  • Duplicated block (8 lines × 11) REDACTED:908 — REDACTED:908-915 | REDACTED:923-930 | REDACTED:937-944 | REDACTED:951-958 | REDACTED:965-972 | REDACTED:981-988 | REDACTED:996-1003 | REDACTED:1011-1018 | REDACTED:1026-1033 | REDACTED:1041-1048 | REDACTED:1056-1063 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) moments/LD/stats_from_genotype_counts.py:842 — moments/LD/stats_from_genotype_counts.py:842-849 | moments/LD/stats_from_genotype_counts.py:1281-1287 — both copies are in the same file, so extract the 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 `moments/LD/stats_from_genotype_counts.py:842` 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 × 20) · ×1
  • Duplicated block (7 lines × 20) moments/LD/Matrices.py:651 — moments/LD/Matrices.py:651-657 | moments/LD/Matrices.py:671-677 | moments/LD/Matrices.py:705-711 | moments/LD/Matrices.py:712-718 | moments/LD/Matrices.py:732-738 | moments/LD/Matrices.py:742-748 | moments/LD/Matrices.py:795-801 | moments/LD/Matrices.py:802-808 | moments/LD/Matrices.py:822-828 | moments/LD/Matrices.py:829-835 | moments/LD/Matrices.py:839-845 | moments/LD/Matrices.py:856-862 | moments/LD/Matrices.py:866-872 | moments/LD/Matrices.py:883-889 | moments/LD/Matrices.py:893-899 | moments/LD/Matrices.py:900-906 | moments/LD/Matrices.py:919-925 | moments/LD/Matrices.py:926-932 | moments/LD/Matrices.py:933-939 | moments/LD/Matrices.py:940-946 — all 20 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 (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) moments/LD/Matrices.py:765 — moments/LD/Matrices.py:765-771 | moments/LD/Matrices.py:775-781 | moments/LD/Matrices.py:788-794 | moments/LD/Matrices.py:815-821 | moments/LD/Matrices.py:849-855 | moments/LD/Matrices.py:876-882 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:765` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 6) · ×1
  • Duplicated block (6–7 lines × 6) moments/LD/stats_from_genotype_counts.py:323 — moments/LD/stats_from_genotype_counts.py:323-329 | moments/LD/stats_from_genotype_counts.py:370-376 | moments/LD/stats_from_genotype_counts.py:646-652 | moments/LD/stats_from_genotype_counts.py:829-835 | moments/LD/stats_from_genotype_counts.py:1009-1014 | moments/LD/stats_from_genotype_counts.py:1050-1055 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 16) · ×1
  • Duplicated block (6 lines × 16) moments/LD/Matrices.py:707 — moments/LD/Matrices.py:707-712 | moments/LD/Matrices.py:744-749 | moments/LD/Matrices.py:767-772 | moments/LD/Matrices.py:790-795 | moments/LD/Matrices.py:797-802 | moments/LD/Matrices.py:817-822 | moments/LD/Matrices.py:824-829 | moments/LD/Matrices.py:841-846 | moments/LD/Matrices.py:851-856 | moments/LD/Matrices.py:868-873 | moments/LD/Matrices.py:878-883 | moments/LD/Matrices.py:895-900 | moments/LD/Matrices.py:902-907 | moments/LD/Matrices.py:921-926 | moments/LD/Matrices.py:928-933 | moments/LD/Matrices.py:935-940 — all 16 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 `moments/LD/Matrices.py:707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) moments/LD/Matrices.py:539 — moments/LD/Matrices.py:539-544 | moments/LD/Matrices.py:563-568 | moments/LD/Matrices.py:584-589 | moments/LD/Matrices.py:608-613 | moments/LD/Matrices.py:683-688 | moments/LD/Matrices.py:700-705 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/Matrices.py:539` 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 (3–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) REDACTED:67 — REDACTED:67-69 | REDACTED:171-176 | REDACTED:304-309 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:171` 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 (5 lines × 14) · ×1
  • Duplicated block (5 lines × 14) moments/LD/Matrices.py:518 — moments/LD/Matrices.py:518-522 | moments/LD/Matrices.py:539-543 | moments/LD/Matrices.py:563-567 | moments/LD/Matrices.py:584-588 | moments/LD/Matrices.py:608-612 | moments/LD/Matrices.py:630-634 | moments/LD/Matrices.py:643-647 | moments/LD/Matrices.py:663-667 | moments/LD/Matrices.py:683-687 | moments/LD/Matrices.py:690-694 | moments/LD/Matrices.py:700-704 | moments/LD/Matrices.py:724-728 | moments/LD/Matrices.py:751-755 | moments/LD/Matrices.py:909-913 — all 14 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 `moments/LD/Matrices.py:518` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 11) · ×1
  • Duplicated block (5 lines × 11) moments/LD/stats_from_genotype_counts.py:155 — moments/LD/stats_from_genotype_counts.py:155-159 | moments/LD/stats_from_genotype_counts.py:172-176 | moments/LD/stats_from_genotype_counts.py:179-183 | moments/LD/stats_from_genotype_counts.py:312-316 | moments/LD/stats_from_genotype_counts.py:347-351 | moments/LD/stats_from_genotype_counts.py:357-361 | moments/LD/stats_from_genotype_counts.py:394-398 | moments/LD/stats_from_genotype_counts.py:404-408 | moments/LD/stats_from_genotype_counts.py:422-426 | moments/LD/stats_from_genotype_counts.py:429-433 | moments/LD/stats_from_genotype_counts.py:453-458 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:453` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 9) · ×1
  • Duplicated block (5 lines × 9) moments/LD/Matrices.py:627 — moments/LD/Matrices.py:627-631 | moments/LD/Matrices.py:640-644 | moments/LD/Matrices.py:660-664 | moments/LD/Matrices.py:680-684 | moments/LD/Matrices.py:697-701 | moments/LD/Matrices.py:721-725 | moments/LD/Matrices.py:761-765 | moments/LD/Matrices.py:784-788 | moments/LD/Matrices.py:811-815 — all 9 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 × 8) · ×1
  • Duplicated block (5 lines × 8) moments/LD/stats_from_genotype_counts.py:167 — moments/LD/stats_from_genotype_counts.py:167-171 | moments/LD/stats_from_genotype_counts.py:323-327 | moments/LD/stats_from_genotype_counts.py:370-374 | moments/LD/stats_from_genotype_counts.py:417-421 | moments/LD/stats_from_genotype_counts.py:646-650 | moments/LD/stats_from_genotype_counts.py:829-833 | moments/LD/stats_from_genotype_counts.py:1009-1013 | moments/LD/stats_from_genotype_counts.py:1050-1054 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/LD/stats_from_genotype_counts.py:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) moments/Triallele/Numerics.py:351 — moments/Triallele/Numerics.py:351-355 | moments/Triallele/Numerics.py:377-385 | moments/Triallele/Numerics.py:453-457 | moments/Triallele/Numerics.py:462-469 — 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 `moments/Triallele/Numerics.py:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) moments/Demes/Demes.py:1410 — moments/Demes/Demes.py:1410-1413 | moments/Demes/Demes.py:1420-1424 | moments/Demes/Demes.py:1438-1444 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `moments/Demes/Demes.py:1420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–26 lines × 2) · ×1
  • Duplicated block (14–26 lines × 2) bench/report.py:39 — bench/report.py:39-52 | bench/report.py:55-80 — both copies are in the same file, so extract the 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 `bench/report.py:39` 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.
Minor — 20 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×6
  • Duplicated predicate moments/Misc.py:380 — `"outgroup_allele" in snp_info and snp_info["outgroup_allele"] != "-" and snp_info["outgroup_allele"] in snp_info["segregating"]` appears character-identically in 2 files — moments/Misc.py, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate moments/LD/stats_from_genotype_counts.py:1310 — `(pop1 == pop3) or (pop1 == pop4) or (pop2 == pop3) or (pop2 == pop4)` appears character-identically in 2 files — moments/LD/stats_from_genotype_counts.py, moments/LD/stats_from_haplotype_counts.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate moments/Inference.py:78 — `(verbose > 0) and (_counter % verbose == 0)` appears character-identically in 3 files — moments/Inference.py, moments/LD/Inference.py, moments/TwoLocus/Inference.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:112 — `data_folded is None or data_folded == data.folded` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate moments/Demographics3D.py:22 — `pop_ids is not None and len(pop_ids) != 3` appears character-identically in 2 files — moments/Demographics3D.py, moments/LD/Demographics3D.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate moments/Triallele/Integration.py:75 — `t_elapsed == 0 or N_old != N or dt != dt_old` appears character-identically in 2 files — moments/Triallele/Integration.py, moments/TwoLocus/Integration.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
D34 · Knowledge Freshness · Orphaned file · ×4
  • Orphaned file moments/LinearSystem.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file bench/gen_lim_fs_extrap.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file moments/Numerics.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file bench/demographic_models_dadi.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 4 significant file(s) lose their only recent owner: moments/Demes/Demes.py, moments/Demes/Inference.py, moments/LD/Inference.py, moments/Misc.py. Pair on, review, or document these before any departure.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 1 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (33676 LoC, 58 module-visible types across 12 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 4 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: moments/LinearSystem.py, bench/gen_lim_fs_extrap.py, moments/Numerics.py, bench/demographic_models_dadi.py (6 orphaned of 45 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 45 of the 55 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M2 · Architecture documentation · No architecture diagram/doc · ×1
  • No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:2 — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 8854 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
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.)
Minor — 1 finding(s)
D12 · Dependency Hygiene · Dependency hygiene PARTLY measured · ×1
  • Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 11 shipped distribution(s) across 2 manifest(s) (0 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.

Appendix B — Reproduction & audit trail

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

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-0081d3780dee4cbab691a4ccd2c3ce2f/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-0081d3780dee4cbab691a4ccd2c3ce2f/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 --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .69artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .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 --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a19150-e854-7d32-8cde-06c339f7dc4c · 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