Public report of Farama-Foundation/Gymnasium, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 07:45 UTC · Survey ID cd_3574a6e9ae7840048e0725071ab866cd
Farama-Foundation/Gymnasium
Measured 17 November 2026, 07:44 UTC, at code version 68c3f95
First survey, so nothing to compare with yet
CAI scoreStrong
CriticalWeakAdequateStrongExemplary
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: 32,194 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 0.4 person-years · Weakest lens: Production Readiness, 59.0
Findings by how serious they are
31 critical282 serious39 minor
13 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 07:44 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
42of 42 dimensions measured by tools.
342of 352 findings point to an exact file and line, so you can open each one in the code. The other 10 concern the repository as a whole, such as missing documentation.
42dimensions across 5 lenses, read from 32,194 lines of product code in 2 projects.
Farama-Foundation/Gymnasium meets our standard for a template or a sample. It scores 66.9 out of 100 and is rated Strong, and 30 of its 31 critical findings are security problems in the build pipeline and in its automatic dependency updates.
Every lens scores high enough to be rated Strong, so no single lens holds the score back. The best first step is adding automated security scanning, worth about 4.9 points. Adding tests for untested code comes next, worth about 3.1 points.
Twenty-eight pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One automatic update takes new releases before a bad one can be spotted, and one secret can leak from the build pipeline. Pinning each tool to an exact version, setting a waiting period for automatic updates and limiting the secret to its own step would close these risks. The part of the code nobody has worked on for a long time needs someone to learn and document it before anyone changes it.
The product code is 32,194 lines, about €59,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Every lens already scores high enough to be rated Strong, so no single lens holds the score back.
Code composition: what the lines of code are
Product code 67%Tests 33%
Rebuild cost: about €59,000 · Estimate
Cost to rebuild
€20,000 to €98,000, for 325 to 1,031 hours of work, about 0.4 person-years for one engineer
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.9 at a score of 67. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 32,194 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
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.
Resolve the 52 Low coverage finding(s) in Code Coverage — start with __init__.py (2), cartpole.py (2), array_conversion.py (2).
Raises the score by about 3.1 points · Medium effort · Code Coverage
3
Keep a changelog (e.g.
Keep-a-Changelog) recording what shipped in each release.
Raises the score by about 3.2 points · Medium effort · Release Hygiene
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.
Files that change often carry extra risk · Combined risk
One file is changed often and is hard to read, which makes it the likeliest place for a mistake. It also has under half its code tested, or was written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to this file therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (3 files) · Code Coverage (45 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: env_match.py
What to do: Add tests to these files and have a second person review every change to them, starting with env_match.py.
Where the investment is most exposed · Value at risk
This code would cost about €59,000 to build again, about 0.4 person-years of work. Its weakest lens is Production Readiness, at 59.0 (Adequate). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
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. Of all the actions in this report, it raises the score most for the work it takes: about 4.9 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 7.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 6% on every change. The history of the code shows how much it changes: about 9,065 lines over the last 90 days, which is about 36,764 lines a year. At that pace, the extra work comes to an estimated 2.3 to 13.8 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
112 modules, with 193 dependencies between them. One loop runs through 2 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 72 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
experimental.functional uses spaces.space, so a change to spaces.space can break experimental.functional, while a change to experimental.functional can't break spaces.space.
Position
Below the diagonal: experimental.functional uses a module listed above it, which is the healthy direction.
spaces.multi_binary uses spaces.space, so a change to spaces.space can break spaces.multi_binary, while a change to spaces.multi_binary can't break spaces.space.
Position
Below the diagonal: spaces.multi_binary uses a module listed above it, which is the healthy direction.
spaces.multi_discrete uses spaces.space, so a change to spaces.space can break spaces.multi_discrete, while a change to spaces.multi_discrete can't break spaces.space.
Position
Below the diagonal: spaces.multi_discrete uses a module listed above it, which is the healthy direction.
vector.vector_env uses spaces.space, so a change to spaces.space can break vector.vector_env, while a change to vector.vector_env can't break spaces.space.
Position
Below the diagonal: vector.vector_env uses a module listed above it, which is the healthy direction.
envs.registration uses vector.vector_env, so a change to vector.vector_env can break envs.registration, while a change to envs.registration can't break vector.vector_env.
Position
Below the diagonal: envs.registration uses a module listed above it, which is the healthy direction.
vector.utils uses spaces.multi_binary, so a change to spaces.multi_binary can break vector.utils, while a change to vector.utils can't break spaces.multi_binary.
Position
Below the diagonal: vector.utils uses a module listed above it, which is the healthy direction.
vector.utils uses spaces.multi_discrete, so a change to spaces.multi_discrete can break vector.utils, while a change to vector.utils can't break spaces.multi_discrete.
Position
Below the diagonal: vector.utils uses a module listed above it, which is the healthy direction.
wrappers uses spaces.multi_discrete, so a change to spaces.multi_discrete can break wrappers, while a change to wrappers can't break spaces.multi_discrete.
Position
Below the diagonal: wrappers uses a module listed above it, which is the healthy direction.
wrappers.vector.array_conversion uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.vector.array_conversion, while a change to wrappers.vector.array_conversion can't break utils.record_constructor.
Position
Below the diagonal: wrappers.vector.array_conversion uses a module listed above it, which is the healthy direction.
wrappers.vector.array_conversion uses vector.vector_env, so a change to vector.vector_env can break wrappers.vector.array_conversion, while a change to wrappers.vector.array_conversion can't break vector.vector_env.
Position
Below the diagonal: wrappers.vector.array_conversion uses a module listed above it, which is the healthy direction.
wrappers.vector.stateful_observation uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.vector.stateful_observation, while a change to wrappers.vector.stateful_observation can't break utils.record_constructor.
Position
Below the diagonal: wrappers.vector.stateful_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.stateful_observation uses spaces.box, so a change to spaces.box can break wrappers.vector.stateful_observation, while a change to wrappers.vector.stateful_observation can't break spaces.box.
Position
Below the diagonal: wrappers.vector.stateful_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.stateful_observation uses vector.vector_env, so a change to vector.vector_env can break wrappers.vector.stateful_observation, while a change to wrappers.vector.stateful_observation can't break vector.vector_env.
Position
Below the diagonal: wrappers.vector.stateful_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.stateful_reward uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.vector.stateful_reward, while a change to wrappers.vector.stateful_reward can't break utils.record_constructor.
Position
Below the diagonal: wrappers.vector.stateful_reward uses a module listed above it, which is the healthy direction.
wrappers.vector.stateful_reward uses vector.vector_env, so a change to vector.vector_env can break wrappers.vector.stateful_reward, while a change to wrappers.vector.stateful_reward can't break vector.vector_env.
Position
Below the diagonal: wrappers.vector.stateful_reward uses a module listed above it, which is the healthy direction.
envs.box2d.bipedal_walker uses utils.ezpickle, so a change to utils.ezpickle can break envs.box2d.bipedal_walker, while a change to envs.box2d.bipedal_walker can't break utils.ezpickle.
Position
Below the diagonal: envs.box2d.bipedal_walker uses a module listed above it, which is the healthy direction.
envs.box2d.bipedal_walker uses core, so a change to core can break envs.box2d.bipedal_walker, while a change to envs.box2d.bipedal_walker can't break core.
Position
Below the diagonal: envs.box2d.bipedal_walker uses a module listed above it, which is the healthy direction.
envs.box2d.car_racing uses utils.ezpickle, so a change to utils.ezpickle can break envs.box2d.car_racing, while a change to envs.box2d.car_racing can't break utils.ezpickle.
Position
Below the diagonal: envs.box2d.car_racing uses a module listed above it, which is the healthy direction.
envs.box2d.lunar_lander uses utils.ezpickle, so a change to utils.ezpickle can break envs.box2d.lunar_lander, while a change to envs.box2d.lunar_lander can't break utils.ezpickle.
Position
Below the diagonal: envs.box2d.lunar_lander uses a module listed above it, which is the healthy direction.
envs.functional_jax_env uses experimental.functional, so a change to experimental.functional can break envs.functional_jax_env, while a change to envs.functional_jax_env can't break experimental.functional.
Position
Below the diagonal: envs.functional_jax_env uses a module listed above it, which is the healthy direction.
envs.functional_jax_env uses vector.vector_env, so a change to vector.vector_env can break envs.functional_jax_env, while a change to envs.functional_jax_env can't break vector.vector_env.
Position
Below the diagonal: envs.functional_jax_env uses a module listed above it, which is the healthy direction.
wrappers.array_conversion uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.array_conversion, while a change to wrappers.array_conversion can't break utils.record_constructor.
Position
Below the diagonal: wrappers.array_conversion uses a module listed above it, which is the healthy direction.
wrappers.array_conversion uses core, so a change to core can break wrappers.array_conversion, while a change to wrappers.array_conversion can't break core.
Position
Below the diagonal: wrappers.array_conversion uses a module listed above it, which is the healthy direction.
wrappers.transform_action uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.transform_action, while a change to wrappers.transform_action can't break utils.record_constructor.
Position
Below the diagonal: wrappers.transform_action uses a module listed above it, which is the healthy direction.
wrappers.transform_action uses core, so a change to core can break wrappers.transform_action, while a change to wrappers.transform_action can't break core.
Position
Below the diagonal: wrappers.transform_action uses a module listed above it, which is the healthy direction.
wrappers.transform_observation uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.transform_observation, while a change to wrappers.transform_observation can't break utils.record_constructor.
Position
Below the diagonal: wrappers.transform_observation uses a module listed above it, which is the healthy direction.
wrappers.transform_observation uses core, so a change to core can break wrappers.transform_observation, while a change to wrappers.transform_observation can't break core.
Position
Below the diagonal: wrappers.transform_observation uses a module listed above it, which is the healthy direction.
wrappers.transform_reward uses utils.record_constructor, so a change to utils.record_constructor can break wrappers.transform_reward, while a change to wrappers.transform_reward can't break utils.record_constructor.
Position
Below the diagonal: wrappers.transform_reward uses a module listed above it, which is the healthy direction.
wrappers.transform_reward uses core, so a change to core can break wrappers.transform_reward, while a change to wrappers.transform_reward can't break core.
Position
Below the diagonal: wrappers.transform_reward uses a module listed above it, which is the healthy direction.
envs.phys2d.cartpole uses utils.ezpickle, so a change to utils.ezpickle can break envs.phys2d.cartpole, while a change to envs.phys2d.cartpole can't break utils.ezpickle.
Position
Below the diagonal: envs.phys2d.cartpole uses a module listed above it, which is the healthy direction.
envs.phys2d.cartpole uses experimental.functional, so a change to experimental.functional can break envs.phys2d.cartpole, while a change to envs.phys2d.cartpole can't break experimental.functional.
Position
Below the diagonal: envs.phys2d.cartpole uses a module listed above it, which is the healthy direction.
envs.phys2d.cartpole uses envs.functional_jax_env, so a change to envs.functional_jax_env can break envs.phys2d.cartpole, while a change to envs.phys2d.cartpole can't break envs.functional_jax_env.
Position
Below the diagonal: envs.phys2d.cartpole uses a module listed above it, which is the healthy direction.
envs.phys2d.pendulum uses utils.ezpickle, so a change to utils.ezpickle can break envs.phys2d.pendulum, while a change to envs.phys2d.pendulum can't break utils.ezpickle.
Position
Below the diagonal: envs.phys2d.pendulum uses a module listed above it, which is the healthy direction.
envs.phys2d.pendulum uses experimental.functional, so a change to experimental.functional can break envs.phys2d.pendulum, while a change to envs.phys2d.pendulum can't break experimental.functional.
Position
Below the diagonal: envs.phys2d.pendulum uses a module listed above it, which is the healthy direction.
envs.phys2d.pendulum uses envs.functional_jax_env, so a change to envs.functional_jax_env can break envs.phys2d.pendulum, while a change to envs.phys2d.pendulum can't break envs.functional_jax_env.
Position
Below the diagonal: envs.phys2d.pendulum uses a module listed above it, which is the healthy direction.
envs.tabular.blackjack uses utils.ezpickle, so a change to utils.ezpickle can break envs.tabular.blackjack, while a change to envs.tabular.blackjack can't break utils.ezpickle.
Position
Below the diagonal: envs.tabular.blackjack uses a module listed above it, which is the healthy direction.
envs.tabular.blackjack uses experimental.functional, so a change to experimental.functional can break envs.tabular.blackjack, while a change to envs.tabular.blackjack can't break experimental.functional.
Position
Below the diagonal: envs.tabular.blackjack uses a module listed above it, which is the healthy direction.
envs.tabular.blackjack uses envs.functional_jax_env, so a change to envs.functional_jax_env can break envs.tabular.blackjack, while a change to envs.tabular.blackjack can't break envs.functional_jax_env.
Position
Below the diagonal: envs.tabular.blackjack uses a module listed above it, which is the healthy direction.
envs.tabular.cliffwalking uses utils.ezpickle, so a change to utils.ezpickle can break envs.tabular.cliffwalking, while a change to envs.tabular.cliffwalking can't break utils.ezpickle.
Position
Below the diagonal: envs.tabular.cliffwalking uses a module listed above it, which is the healthy direction.
envs.tabular.cliffwalking uses experimental.functional, so a change to experimental.functional can break envs.tabular.cliffwalking, while a change to envs.tabular.cliffwalking can't break experimental.functional.
Position
Below the diagonal: envs.tabular.cliffwalking uses a module listed above it, which is the healthy direction.
envs.tabular.cliffwalking uses envs.functional_jax_env, so a change to envs.functional_jax_env can break envs.tabular.cliffwalking, while a change to envs.tabular.cliffwalking can't break envs.functional_jax_env.
Position
Below the diagonal: envs.tabular.cliffwalking uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_action uses spaces.space, so a change to spaces.space can break wrappers.vector.vectorize_action, while a change to wrappers.vector.vectorize_action can't break spaces.space.
Position
Below the diagonal: wrappers.vector.vectorize_action uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_action uses vector.vector_env, so a change to vector.vector_env can break wrappers.vector.vectorize_action, while a change to wrappers.vector.vectorize_action can't break vector.vector_env.
Position
Below the diagonal: wrappers.vector.vectorize_action uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_action uses core, so a change to core can break wrappers.vector.vectorize_action, while a change to wrappers.vector.vectorize_action can't break core.
Position
Below the diagonal: wrappers.vector.vectorize_action uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_action uses wrappers.transform_action, so a change to wrappers.transform_action can break wrappers.vector.vectorize_action, while a change to wrappers.vector.vectorize_action can't break wrappers.transform_action.
Position
Below the diagonal: wrappers.vector.vectorize_action uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_observation uses spaces.space, so a change to spaces.space can break wrappers.vector.vectorize_observation, while a change to wrappers.vector.vectorize_observation can't break spaces.space.
Position
Below the diagonal: wrappers.vector.vectorize_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_observation uses vector.vector_env, so a change to vector.vector_env can break wrappers.vector.vectorize_observation, while a change to wrappers.vector.vectorize_observation can't break vector.vector_env.
Position
Below the diagonal: wrappers.vector.vectorize_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_observation uses core, so a change to core can break wrappers.vector.vectorize_observation, while a change to wrappers.vector.vectorize_observation can't break core.
Position
Below the diagonal: wrappers.vector.vectorize_observation uses a module listed above it, which is the healthy direction.
wrappers.vector.vectorize_observation uses wrappers.transform_observation, so a change to wrappers.transform_observation can break wrappers.vector.vectorize_observation, while a change to wrappers.vector.vectorize_observation can't break wrappers.transform_observation.
Position
Below the diagonal: wrappers.vector.vectorize_observation uses a module listed above it, which is the healthy direction.
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
31
High / Critical
A03:2025 — Software Supply Chain Failures
4
Medium
Roadmap
Top priorities: 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; Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release; Resolve the 52 Low coverage finding(s) in Code Coverage — start with __init__.py (2), cartpole.py (2), array_conversion.py (2).
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 31
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 — 282
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 — 39
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 42 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 42 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 342 of 352 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 4 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (pyproject.toml), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in gymnasium/envs/registration.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Java was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP or Rust was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala, Rust, Go, Swift, Erlang, F# and Visual Basic source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, 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.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
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.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
+ 19 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 24 bodies over 15 down to 15 or less in Cyclomatic Complexity — start with CarRacing._create_track (cyclomatic 35), registration.make (cyclomatic 34), env_match.check_environments_match (cyclomatic 30). — 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 24 together lifts Cyclomatic Complexity from 7.2 to about 10.0/10, projected with the scoring formula itself and assuming each lands exactly at 15.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 45 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 11 bodies over 30 down to 30 or less in Cognitive Complexity — start with CarRacing._create_track (cognitive 61), async_vector_env._async_worker (cognitive 47), registration.make (cognitive 43). — 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 11 together lifts Cognitive Complexity from 5.3 to about 6.7/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes9.3 / 10Stronggated by 5 serious findings✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 5 FileTooLong finding(s) in God Classes — start with bipedal_walker.py, registration.py, mujoco_rendering.py. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
79 duplicated block group(s) detected. 10.9 % of the production lines (3,509 of 32,194) are in a reported copy. A further 47 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.
+ 82 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with async_vector_env.py (2), bipedal_walker.py, rendering.py. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 6 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with hopper_v4.py, hopper_v5.py, async_vector_env.py. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 5 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with cliffwalking.py, rendering.py, pendulum.py. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with core.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D8 · Code Coverage8.7 / 10Strong✓ Tool-verified
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
Line coverage 50.9% — 52 file(s) below 50%. Measured from the Python suite (repository root: `coverage run -m pytest`, the 3 run(s) test reliability made). Taken over 3 runs of the suite: a line counts as covered only when every run executed it.
Resolve the 52 Low coverage finding(s) in Code Coverage — start with __init__.py (2), cartpole.py (2), array_conversion.py (2). — One of this dimension's main actionable groups (52 warning-level).
Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests pass reliably, with no flakiness.
Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
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.
0 of 4 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 4 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (0 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. This repository publishes itself under MIT License, which is its own choice and is not judged here.
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.
Resolve the 3 Hotspot finding(s) in Churn × Complexity Hotspots — start with async_vector_env.py, box.py, env_match.py. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
1 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is gymnasium/utils/performance.py. Counted over 93 of the 120 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
12 deducted task-comment markers across 32194 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 12 TodoComment finding(s) in Explicit Debt — start with test_async_vector_env.py (2), array_conversion.py (2), test_normalize_reward.py. — One of this dimension's main actionable groups (12 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
1 of 2 build units (Python) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesionpyproject.toml:1
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with pyproject.toml. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D27 · Navigability8.0 / 10Strong✓ 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.
63 % of calls cross a namespace and 0 % go through an interface, but 36 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.
Scattered collaborators
What to do
Resolve the 1 Scattered collaborators finding(s) in Navigability. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d27_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
31 finding(s): 0 critical, 30 high, 1 medium, 0 low. 28 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
No action in Static Analysis (SAST) — all 28 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 (28 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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.
7 of 93 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is gymnasium/envs/box2d/bipedal_walker.py. Counted over 93 of the 120 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with bipedal_walker.py. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 6 Orphaned file finding(s) in Knowledge Freshness — start with blackjack.py, car_dynamics.py, cartpole.py. — One of this dimension's main actionable groups (6 recommendation-level).
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.
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.
Resolve the 2 Change coupling finding(s) in Change Coupling — start with humanoid_v5.py, utils.py. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 4 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
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.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
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.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability5.5 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `docs`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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 8 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:12
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:7
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.
Dependabot is configured but does not watch `pip` — add that `package-ecosystem` entry to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
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.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.3 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`data_equivalence` is public and takes `data_1: Any` from its caller, and it calls itself at line 51 (`data_equivalence`) with a piece of `data_1` (and at line 55, line 62) — and nowhere in `data_equivalence` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `data_equivalence` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — gymnasium/utils/env_checker.py:51
`check_obs` is public and takes `obs: Any` from its caller, and it calls itself at line 163 (`check_obs`) with a piece of `obs` (and at line 170) — and nowhere in `check_obs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `check_obs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — gymnasium/utils/passive_env_checker.py:163
`data_shares_objects` is public and takes `data_1: Any` from its caller, and it calls itself at line 196 (`data_shares_objects`) with a piece of `data_1` (and at line 203, line 209) — and nowhere in `data_shares_objects` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `data_shares_objects` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — gymnasium/utils/passive_env_checker.py:196
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×2) — gymnasium/__init__.py:69, gymnasium/envs/mujoco/mujoco_rendering.py:218
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
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.
Capped 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 — 21 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 — 73 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.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — no interface, protocol or abstract type declares an operation an implementer must write
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
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 — ~15833 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
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 — this repo declares itself a template / kata / sample / demo; a formal ADR log is deferred to a real application built from it.
D21 Naming Consistency — D21 withholds its case and prefix conventions rows: 2 candidate(s) found and not reported.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .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.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (11 value object(s))
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
M2 Architecture documentation — This repo declares itself a template / kata / sample / demo — formal architecture documentation (ADRs, C4 diagrams) is deferred to a real application built from it, so its absence is not a defect here.
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 121 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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.
Orphaned knowledge gymnasium/envs/box2d/bipedal_walker.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.
TodoComment tests/wrappers/test_normalize_reward.py:48— # TODO: Functional correctness should be tested — 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 tests/wrappers/test_passive_env_checker.py:29— # todo, add check for render, bugged due to mujoco v2/3 and v4 envs — 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 tests/vector/test_async_vector_env.py:237— # TODO, these tests do nothing, understand the purpose of the tests and fix them — 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 tests/vector/test_async_vector_env.py:250— # TODO, these tests do nothing, understand the purpose of the tests and fix them — 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 tests/utils/test_save_video.py:111— # TODO: fix this test (see https://github.com/openai/gym/issues/3054)
TodoComment gymnasium/wrappers/array_conversion.py:54— # TODO: Switch to ArrayAPI type once https://github.com/data-apis/array-api/pull/589 is merged
TodoComment gymnasium/wrappers/array_conversion.py:55— # TODO: Switch to ArrayAPI type if available — 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 gymnasium/wrappers/jax_to_torch.py:91— # TODO: Device was part of the public API, but should be removed in favor of _env_device and — 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 gymnasium/wrappers/vector/stateful_observation.py:128— # TODO: remove ignore comment once `ty` supports `@single_dispatch` — 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 gymnasium/wrappers/vector/vectorize_action.py:91— # TODO: We could compute single_action_space from the action_space if only the latter is provided and avoid the warning below. — 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 gymnasium/wrappers/vector/vectorize_observation.py:89— # TODO: We could compute single_observation_space from the observation_space if only the latter is provided and avoid the warning below. — 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 gymnasium/utils/env_checker.py:394— # todo - Add to gymlibrary.ml? — 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.
Duplicated block (12 lines × 2) gymnasium/envs/box2d/bipedal_walker.py:311— gymnasium/envs/box2d/bipedal_walker.py:311-322 | gymnasium/envs/box2d/bipedal_walker.py:338-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/envs/box2d/bipedal_walker.py:311` 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) gymnasium/vector/async_vector_env.py:230— gymnasium/vector/async_vector_env.py:230-241 | gymnasium/vector/sync_vector_env.py:125-136 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) gymnasium/vector/async_vector_env.py:440— gymnasium/vector/async_vector_env.py:440-451 | gymnasium/vector/async_vector_env.py:637-648 — both copies are in the same file, so extract the 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 `gymnasium/vector/async_vector_env.py:440` 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) gymnasium/wrappers/rendering.py:572— gymnasium/wrappers/rendering.py:572-583 | gymnasium/wrappers/vector/rendering.py:192-203 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 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 (12 lines × 2) gymnasium/wrappers/transform_action.py:280— gymnasium/wrappers/transform_action.py:280-291 | gymnasium/wrappers/transform_observation.py:842-853 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) gymnasium/wrappers/array_conversion.py:277— gymnasium/wrappers/array_conversion.py:277-288 | gymnasium/wrappers/vector/array_conversion.py:117-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) gymnasium/envs/mujoco/hopper_v4.py:124— gymnasium/envs/mujoco/hopper_v4.py:124-131 | gymnasium/envs/mujoco/walker2d_v4.py:116-123 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/walker2d_v4.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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 (8 lines × 2) gymnasium/envs/mujoco/hopper_v5.py:276— gymnasium/envs/mujoco/hopper_v5.py:276-283 | gymnasium/envs/mujoco/walker2d_v5.py:276-283 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v5.py` and `gymnasium/envs/mujoco/walker2d_v5.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 131 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 (8 lines × 2) gymnasium/vector/async_vector_env.py:369— gymnasium/vector/async_vector_env.py:369-376 | gymnasium/vector/sync_vector_env.py:214-221 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) gymnasium/wrappers/transform_action.py:294— gymnasium/wrappers/transform_action.py:294-301 | gymnasium/wrappers/transform_observation.py:856-863 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) gymnasium/wrappers/vector/dict_info_to_list.py:123— gymnasium/wrappers/vector/dict_info_to_list.py:123-130 | gymnasium/wrappers/vector/dict_info_to_list.py:142-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) gymnasium/envs/box2d/bipedal_walker.py:539— gymnasium/envs/box2d/bipedal_walker.py:539-546 | gymnasium/envs/box2d/bipedal_walker.py:547-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
FileTooLong: box2d/bipedal_walker.py gymnasium/envs/box2d/bipedal_walker.py— FileTooLong — 632 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 132 over it, 1.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: envs/registration.py gymnasium/envs/registration.py— FileTooLong — 624 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 124 over it, 1.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: mujoco/mujoco_rendering.py gymnasium/envs/mujoco/mujoco_rendering.py— FileTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 90 over it, 1.18× 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: box2d/car_racing.py gymnasium/envs/box2d/car_racing.py— FileTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 89 over it, 1.18× 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: vector/async_vector_env.py gymnasium/vector/async_vector_env.py— FileTooLong — 583 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 83 over it, 1.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Duplicated block (10 lines × 2) gymnasium/envs/toy_text/cliffwalking.py:205— gymnasium/envs/toy_text/cliffwalking.py:205-214 | gymnasium/envs/toy_text/frozen_lake.py:326-335 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) gymnasium/wrappers/rendering.py:296— gymnasium/wrappers/rendering.py:296-305 | gymnasium/wrappers/vector/rendering.py:350-359 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 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 (10 lines × 2) gymnasium/envs/classic_control/pendulum.py:205— gymnasium/envs/classic_control/pendulum.py:205-214 | gymnasium/envs/phys2d/pendulum.py:144-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) gymnasium/envs/mujoco/walker2d_v4.py:99— gymnasium/envs/mujoco/walker2d_v4.py:99-108 | gymnasium/envs/mujoco/walker2d_v5.py:264-273 — before extracting anything, compare `gymnasium/envs/mujoco/walker2d_v4.py` and `gymnasium/envs/mujoco/walker2d_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 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 (10 lines × 2) gymnasium/wrappers/jax_to_torch.py:82— gymnasium/wrappers/jax_to_torch.py:82-93 | gymnasium/wrappers/numpy_to_torch.py:68-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×4
Edited copy of a member (13 corresponding lines) gymnasium/envs/mujoco/half_cheetah_v4.py:77— gymnasium/envs/mujoco/half_cheetah_v4.py:77-99 | gymnasium/envs/mujoco/half_cheetah_v5.py:228-240 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:183— gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:183-195 | gymnasium/envs/mujoco/reacher_v5.py:194-207 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) gymnasium/envs/phys2d/cartpole.py:235— gymnasium/envs/phys2d/cartpole.py:235-247 | gymnasium/envs/phys2d/pendulum.py:206-218 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) gymnasium/spaces/discrete.py:244— gymnasium/spaces/discrete.py:244-259 | gymnasium/spaces/multi_discrete.py:324-336 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (9 lines × 2) gymnasium/envs/classic_control/cartpole.py:126— gymnasium/envs/classic_control/cartpole.py:126-134 | gymnasium/envs/classic_control/cartpole.py:379-387 — both copies are in the same file, so extract the 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, `gymnasium/envs/classic_control/cartpole.py:391` calls `zeros` and `gymnasium/envs/classic_control/cartpole.py:137` 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 (9 lines × 2) gymnasium/envs/classic_control/continuous_mountain_car.py:187— gymnasium/envs/classic_control/continuous_mountain_car.py:187-195 | gymnasium/envs/classic_control/mountain_car.py:163-171 — before extracting anything, compare `gymnasium/envs/classic_control/continuous_mountain_car.py` and `gymnasium/envs/classic_control/mountain_car.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 160 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 (9 lines × 2) gymnasium/envs/functional_jax_env.py:49— gymnasium/envs/functional_jax_env.py:49-57 | gymnasium/envs/functional_jax_env.py:156-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) gymnasium/wrappers/vector/jax_to_torch.py:39— gymnasium/wrappers/vector/jax_to_torch.py:39-47 | gymnasium/wrappers/vector/numpy_to_torch.py:48-56 — 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. Note first that the copies are not typed on the same thing: `Device` names `gymnasium.wrappers.jax_to_torch` in one and `gymnasium.wrappers.numpy_to_torch` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 2) gymnasium/envs/box2d/car_racing.py:488— gymnasium/envs/box2d/car_racing.py:488-493 | gymnasium/envs/box2d/car_racing.py:495-501 — both copies are in the same file, so extract the 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 `gymnasium/envs/box2d/car_racing.py:488` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) gymnasium/envs/mujoco/swimmer_v4.py:65— gymnasium/envs/mujoco/swimmer_v4.py:65-70 | gymnasium/envs/mujoco/swimmer_v5.py:227-232 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) gymnasium/envs/tabular/cliffwalking.py:250— gymnasium/envs/tabular/cliffwalking.py:250-255 | gymnasium/envs/toy_text/cliffwalking.py:259-264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) gymnasium/wrappers/array_conversion.py:291— gymnasium/wrappers/array_conversion.py:291-296 | gymnasium/wrappers/vector/array_conversion.py:131-136 — 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.
Hotspot: gymnasium/vector/async_vector_env.py gymnasium/vector/async_vector_env.py:827— gymnasium/vector/async_vector_env.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in async_vector_env._async_worker at line 827. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 11:50:57 +00:00' --until='2026-11-12 11:50:57 +00:00' --full-history --no-merges -- gymnasium/vector/async_vector_env.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: gymnasium/spaces/box.py gymnasium/spaces/box.py:236— gymnasium/spaces/box.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in Box._cast_low at line 236. 2 of those changes were fix/bug commits, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 11:50:57 +00:00' --until='2026-11-12 11:50:57 +00:00' --full-history --no-merges -- gymnasium/spaces/box.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: gymnasium/utils/env_match.py gymnasium/utils/env_match.py:9— gymnasium/utils/env_match.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in env_match.check_environments_match at line 9. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 11:50:57 +00:00' --until='2026-11-12 11:50:57 +00:00' --full-history --no-merges -- gymnasium/utils/env_match.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×3
Edited copy of a member (8 corresponding lines) gymnasium/spaces/utils.py:612— gymnasium/spaces/utils.py:612-619 | gymnasium/spaces/utils.py:624-634 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) gymnasium/envs/mujoco/inverted_pendulum_v4.py:39— gymnasium/envs/mujoco/inverted_pendulum_v4.py:39-46 | gymnasium/envs/mujoco/inverted_pendulum_v5.py:160-175 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) gymnasium/envs/mujoco/inverted_pendulum_v4.py:49— gymnasium/envs/mujoco/inverted_pendulum_v4.py:49-56 | gymnasium/envs/mujoco/inverted_pendulum_v5.py:178-188 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) gymnasium/envs/mujoco/reacher_v4.py:59— gymnasium/envs/mujoco/reacher_v4.py:59-73 | gymnasium/envs/mujoco/reacher_v5.py:224-238 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) gymnasium/wrappers/rendering.py:504— gymnasium/wrappers/rendering.py:504-518 | gymnasium/wrappers/vector/rendering.py:62-76 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `env` to `gym.Env[ObsType, ActType]` in one and `VectorEnv[ObsType, ActType, ArrayType]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 2) gymnasium/envs/mujoco/hopper_v5.py:307— gymnasium/envs/mujoco/hopper_v5.py:307-322 | gymnasium/envs/mujoco/walker2d_v5.py:307-321 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v5.py` and `gymnasium/envs/mujoco/walker2d_v5.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 131 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.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×3
Recursive walk over a caller-supplied document has no depth cap gymnasium/utils/env_checker.py:51— `data_equivalence` is public and takes `data_1: Any` from its caller, and it calls itself at line 51 (`data_equivalence`) with a piece of `data_1` (and at line 55, line 62) — and nowhere in `data_equivalence` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `data_equivalence` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap gymnasium/utils/passive_env_checker.py:163— `check_obs` is public and takes `obs: Any` from its caller, and it calls itself at line 163 (`check_obs`) with a piece of `obs` (and at line 170) — and nowhere in `check_obs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `check_obs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap gymnasium/utils/passive_env_checker.py:196— `data_shares_objects` is public and takes `data_1: Any` from its caller, and it calls itself at line 196 (`data_shares_objects`) with a piece of `data_1` (and at line 203, line 209) — and nowhere in `data_shares_objects` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `data_shares_objects` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Change coupling: humanoid_v5.py ↔ humanoidstandup_v5.py gymnasium/envs/mujoco/humanoid_v5.py:1— `gymnasium/envs/mujoco/humanoid_v5.py` and `gymnasium/envs/mujoco/humanoidstandup_v5.py` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `5d5b2306` Enforce distinct objects for Env.reset and Env.step observations and …; `d0098540` Fix `invalid-parameter-default` ty errors (#1571); `794d2700` fix Quaternion order in Ant, Humanoids Documentation (#1173) — run `git show` on any of them.
Change coupling: utils.py ↔ space_utils.py gymnasium/spaces/utils.py:1— `gymnasium/spaces/utils.py` and `gymnasium/vector/utils/space_utils.py` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 9 shared commits counted here, the most recent 3 are `767c7fc8` Make Dict key sorting optional (#1675); `abf4905a` Update Graph to accept arbitrary node and edge spaces (#1514); `08d8b925` Enforce and fix four `ty` rules (#1570) — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×2
Edited copy of a member (19 corresponding lines) gymnasium/vector/utils/space_utils.py:190— gymnasium/vector/utils/space_utils.py:190-208 | gymnasium/vector/utils/space_utils.py:229-247 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) gymnasium/wrappers/stateful_action.py:177— gymnasium/wrappers/stateful_action.py:177-195 | gymnasium/wrappers/stateful_observation.py:67-86 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×2
Edited copy of a member (25 corresponding lines) gymnasium/envs/mujoco/humanoid_v4.py:136— gymnasium/envs/mujoco/humanoid_v4.py:136-168 | gymnasium/envs/mujoco/humanoid_v5.py:475-499 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) gymnasium/wrappers/vector/vectorize_action.py:73— gymnasium/wrappers/vector/vectorize_action.py:73-97 | gymnasium/wrappers/vector/vectorize_observation.py:69-97 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×2
Edited copy of a member (20 corresponding lines) gymnasium/envs/mujoco/pusher_v4.py:45— gymnasium/envs/mujoco/pusher_v4.py:45-65 | gymnasium/envs/mujoco/reacher_v4.py:37-56 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) gymnasium/envs/phys2d/cartpole.py:306— gymnasium/envs/phys2d/cartpole.py:306-325 | gymnasium/envs/phys2d/pendulum.py:276-295 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×2
Edited copy of a member (11 corresponding lines) gymnasium/envs/mujoco/ant_v4.py:168— gymnasium/envs/mujoco/ant_v4.py:168-178 | gymnasium/envs/mujoco/ant_v5.py:393-403 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) gymnasium/envs/mujoco/humanoidstandup_v4.py:82— gymnasium/envs/mujoco/humanoidstandup_v4.py:82-92 | gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:225-236 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×2
Edited copy of a member (21 corresponding lines) gymnasium/envs/tabular/blackjack.py:77— gymnasium/envs/tabular/blackjack.py:77-97 | gymnasium/envs/tabular/blackjack.py:111-137 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) gymnasium/vector/async_vector_env.py:487— gymnasium/vector/async_vector_env.py:487-509 | gymnasium/vector/async_vector_env.py:596-616 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×2
Edited copy of a member (3 corresponding lines) gymnasium/vector/utils/space_utils.py:81— gymnasium/vector/utils/space_utils.py:81-83 | gymnasium/vector/utils/space_utils.py:98-106 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) gymnasium/core.py:570— gymnasium/core.py:570-572 | gymnasium/vector/vector_env.py:660-668 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×2
Edited copy of a member (4 corresponding lines) gymnasium/envs/mujoco/humanoid_v4.py:16— gymnasium/envs/mujoco/humanoid_v4.py:16-19 | gymnasium/envs/mujoco/humanoid_v5.py:18-21 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) gymnasium/envs/mujoco/ant_v4.py:117— gymnasium/envs/mujoco/ant_v4.py:117-120 | gymnasium/envs/mujoco/ant_v5.py:342-345 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (24 lines × 2) gymnasium/envs/classic_control/cartpole.py:173— gymnasium/envs/classic_control/cartpole.py:173-196 | gymnasium/envs/classic_control/cartpole.py:441-464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) gymnasium/envs/mujoco/hopper_v4.py:135— gymnasium/envs/mujoco/hopper_v4.py:135-158 | gymnasium/envs/mujoco/walker2d_v4.py:127-150 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/walker2d_v4.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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 (21 lines × 2) gymnasium/envs/box2d/bipedal_walker.py:622— gymnasium/envs/box2d/bipedal_walker.py:622-642 | gymnasium/envs/box2d/lunar_lander.py:686-706 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 2) gymnasium/envs/mujoco/pusher_v4.py:68— gymnasium/envs/mujoco/pusher_v4.py:68-88 | gymnasium/envs/mujoco/pusher_v5.py:246-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) gymnasium/envs/mujoco/hopper_v5.py:287— gymnasium/envs/mujoco/hopper_v5.py:287-304 | gymnasium/envs/mujoco/walker2d_v5.py:287-304 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v5.py` and `gymnasium/envs/mujoco/walker2d_v5.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 131 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 (18 lines × 2) gymnasium/wrappers/rendering.py:644— gymnasium/wrappers/rendering.py:644-661 | gymnasium/wrappers/rendering.py:745-762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) gymnasium/spaces/oneof.py:135— gymnasium/spaces/oneof.py:135-144 | gymnasium/spaces/oneof.py:146-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/spaces/oneof.py:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gymnasium/spaces/oneof.py:144` calls `sample` and `gymnasium/spaces/oneof.py:135` 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 (9–10 lines × 2) gymnasium/wrappers/rendering.py:371— gymnasium/wrappers/rendering.py:371-379 | gymnasium/wrappers/vector/rendering.py:481-490 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) gymnasium/envs/box2d/car_racing.py:295— gymnasium/envs/box2d/car_racing.py:295-301 | gymnasium/envs/box2d/car_racing.py:315-321 — both copies are in the same file, so extract the 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) gymnasium/envs/toy_text/cliffwalking.py:217— gymnasium/envs/toy_text/cliffwalking.py:217-223 | gymnasium/envs/toy_text/frozen_lake.py:343-349 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Swallowed exception (empty catch) gymnasium/__init__.py:69— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) gymnasium/envs/mujoco/mujoco_rendering.py:218— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
CarRacing._create_track (cyclomatic 35) gymnasium/envs/box2d/car_racing.py:323— CarRacing._create_track has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
registration.make (cyclomatic 34) gymnasium/envs/registration.py:649— registration.make has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
env_match.check_environments_match (cyclomatic 30) gymnasium/utils/env_match.py:9— env_match.check_environments_match has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
async_vector_env._async_worker (cyclomatic 27) gymnasium/vector/async_vector_env.py:827— async_vector_env._async_worker 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.
LunarLander.step (cyclomatic 26) gymnasium/envs/box2d/lunar_lander.py:488— LunarLander.step has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
play.play (cyclomatic 26) gymnasium/utils/play.py:185— play.play 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.
registration.make_vec (cyclomatic 25) gymnasium/envs/registration.py:844— registration.make_vec has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BipedalWalker._generate_terrain (cyclomatic 23) gymnasium/envs/box2d/bipedal_walker.py:288— BipedalWalker._generate_terrain 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.
BipedalWalker.render (cyclomatic 23) gymnasium/envs/box2d/bipedal_walker.py:620— BipedalWalker.render 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.
CliffWalkingEnv._render_gui (cyclomatic 20) gymnasium/envs/toy_text/cliffwalking.py:240— CliffWalkingEnv._render_gui 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.
AtariPreprocessing.__init__ (cyclomatic 20) gymnasium/wrappers/atari_preprocessing.py:52— AtariPreprocessing.__init__ 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.
WindowViewer._key_callback (cyclomatic 19) gymnasium/envs/mujoco/mujoco_rendering.py:505— WindowViewer._key_callback has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EnvSpec.pprint (cyclomatic 19) gymnasium/envs/registration.py:190— EnvSpec.pprint has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RecordVideo.step (cyclomatic 19) gymnasium/wrappers/vector/rendering.py:453— RecordVideo.step 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.
TaxiEnv._render_gui (cyclomatic 18) gymnasium/envs/toy_text/taxi.py:508— TaxiEnv._render_gui 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.
Box.__init__ (cyclomatic 18) gymnasium/spaces/box.py:124— Box.__init__ 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.
Box._cast_low (cyclomatic 18) gymnasium/spaces/box.py:236— Box._cast_low 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. This shape REPEATS in the file: one other method here (Box._cast_high) 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.
Box._cast_high (cyclomatic 18) gymnasium/spaces/box.py:305— Box._cast_high 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. This shape REPEATS in the file: one other method here (Box._cast_low) 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.
AsyncVectorEnv.__init__ (cyclomatic 18) gymnasium/vector/async_vector_env.py:124— AsyncVectorEnv.__init__ 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.
FrozenLakeEnv._render_gui (cyclomatic 17) gymnasium/envs/toy_text/frozen_lake.py:366— FrozenLakeEnv._render_gui 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.
env_checker.check_env (cyclomatic 17) gymnasium/utils/env_checker.py:407— env_checker.check_env 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.
passive_env_checker._check_render_return (cyclomatic 17) gymnasium/utils/passive_env_checker.py:353— passive_env_checker._check_render_return 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.
passive_env_checker.check_obs (cyclomatic 16) gymnasium/utils/passive_env_checker.py:131— passive_env_checker.check_obs 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.
AsyncVectorEnv.close_extras (cyclomatic 16) gymnasium/vector/async_vector_env.py:697— AsyncVectorEnv.close_extras 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.
CarRacing._create_track (cognitive 61) gymnasium/envs/box2d/car_racing.py:323— CarRacing._create_track has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 12 (19 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
async_vector_env._async_worker (cognitive 47) gymnasium/vector/async_vector_env.py:827— async_vector_env._async_worker has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
registration.make (cognitive 43) gymnasium/envs/registration.py:649— registration.make has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 8, loops 2 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
play.play (cognitive 43) gymnasium/utils/play.py:185— play.play has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.contains (cognitive 41) gymnasium/spaces/graph.py:260— Graph.contains has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (37 pts), boolean chains 4 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DictInfoToList._convert_info_to_list (cognitive 40) gymnasium/wrappers/vector/dict_info_to_list.py:99— DictInfoToList._convert_info_to_list has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 5 (17 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BipedalWalker.render (cognitive 36) gymnasium/envs/box2d/bipedal_walker.py:620— BipedalWalker.render has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 5 (7 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
env_match.check_environments_match (cognitive 33) gymnasium/utils/env_match.py:9— env_match.check_environments_match has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (10 pts), boolean chains 9 (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.
LunarLander.step (cognitive 32) gymnasium/envs/box2d/lunar_lander.py:488— LunarLander.step has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 11, ternaries 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.
BipedalWalker._generate_terrain (cognitive 31) gymnasium/envs/box2d/bipedal_walker.py:288— BipedalWalker._generate_terrain has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 7, loops 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CliffWalkingEnv._render_gui (cognitive 31) gymnasium/envs/toy_text/cliffwalking.py:240— CliffWalkingEnv._render_gui has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 1 (4 pts), error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
registration.make_vec (cognitive 29) gymnasium/envs/registration.py:844— registration.make_vec has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (26 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
TaxiEnv.__init__ (cognitive 28) gymnasium/envs/toy_text/taxi.py:326— TaxiEnv.__init__ has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 3 (12 pts), boolean chains 1 (nesting depth added 19). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
passive_env_checker._check_render_return (cognitive 26) gymnasium/utils/passive_env_checker.py:353— passive_env_checker._check_render_return has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1 (3 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.
AsyncVectorEnv.close_extras (cognitive 26) gymnasium/vector/async_vector_env.py:697— AsyncVectorEnv.close_extras has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (8 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
action_masking_taxi.train_q_learning (cognitive 25) docs/tutorials/training_agents/action_masking_taxi.py:52— action_masking_taxi.train_q_learning has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), ternaries 1 (3 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.
EnvSpec.pprint (cognitive 25) gymnasium/envs/registration.py:190— EnvSpec.pprint has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FilterObservation.__init__ (cognitive 25) gymnasium/wrappers/transform_observation.py:128— FilterObservation.__init__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RecordVideo.step (cognitive 25) gymnasium/wrappers/vector/rendering.py:453— RecordVideo.step has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8 (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.
FrozenLakeEnv.__init__ (cognitive 24) gymnasium/envs/toy_text/frozen_lake.py:232— FrozenLakeEnv.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (6 pts), ternaries 1 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FrozenLakeEnv._render_gui (cognitive 24) gymnasium/envs/toy_text/frozen_lake.py:366— FrozenLakeEnv._render_gui has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
registration.pprint_registry (cognitive 23) gymnasium/envs/registration.py:1026— registration.pprint_registry has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
env_checker.check_env (cognitive 23) gymnasium/utils/env_checker.py:407— env_checker.check_env has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
step_api_compatibility.convert_to_done_step_api (cognitive 23) gymnasium/utils/step_api_compatibility.py:82— step_api_compatibility.convert_to_done_step_api has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, loops 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.
AsyncVectorEnv.__init__ (cognitive 22) gymnasium/vector/async_vector_env.py:124— AsyncVectorEnv.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (4 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AsyncVectorEnv.reset_async (cognitive 22) gymnasium/vector/async_vector_env.py:347— AsyncVectorEnv.reset_async has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 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.
OffScreenViewer.render (cognitive 21) gymnasium/envs/mujoco/mujoco_rendering.py:238— OffScreenViewer.render 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.
Box._cast_low (cognitive 21) gymnasium/spaces/box.py:236— Box._cast_low has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Box._cast_high) 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.
Box._cast_high (cognitive 21) gymnasium/spaces/box.py:305— Box._cast_high has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Box._cast_low) 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.
SyncVectorEnv.reset (cognitive 21) gymnasium/vector/sync_vector_env.py:195— SyncVectorEnv.reset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AtariPreprocessing.__init__ (cognitive 21) gymnasium/wrappers/atari_preprocessing.py:52— AtariPreprocessing.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LunarLander.render (cognitive 20) gymnasium/envs/box2d/lunar_lander.py:684— LunarLander.render has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 6 (8 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Car.draw (cognitive 19) gymnasium/envs/box2d/car_dynamics.py:278— Car.draw has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
frozen_lake.is_valid (cognitive 19) gymnasium/envs/toy_text/frozen_lake.py:36— frozen_lake.is_valid has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 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.
Graph.sample (cognitive 19) gymnasium/spaces/graph.py:155— Graph.sample has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
env_checker.check_space_limit (cognitive 19) gymnasium/utils/env_checker.py:369— env_checker.check_space_limit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Car.step (cognitive 18) gymnasium/envs/box2d/car_dynamics.py:182— Car.step has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 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.
CliffWalkingFunctional.render_image (cognitive 18) gymnasium/envs/tabular/cliffwalking.py:274— CliffWalkingFunctional.render_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (4 pts), error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
env_checker.check_reset_seed_determinism (cognitive 18) gymnasium/utils/env_checker.py:79— env_checker.check_reset_seed_determinism has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
passive_env_checker.check_obs (cognitive 18) gymnasium/utils/passive_env_checker.py:131— passive_env_checker.check_obs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VectorEnv._add_info (cognitive 18) gymnasium/vector/vector_env.py:361— VectorEnv._add_info has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, 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.
TimeAwareObservation.__init__ (cognitive 18) gymnasium/wrappers/stateful_observation.py:171— TimeAwareObservation.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TaxiEnv._render_gui (cognitive 17) gymnasium/envs/toy_text/taxi.py:508— TaxiEnv._render_gui has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), error handling 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Graph.seed (cognitive 17) gymnasium/spaces/graph.py:85— Graph.seed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (17 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.
AtariPreprocessing.step (cognitive 17) gymnasium/wrappers/atari_preprocessing.py:177— AtariPreprocessing.step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BipedalWalkerHeuristics.step_heuristic (cognitive 16) gymnasium/envs/box2d/bipedal_walker.py:798— BipedalWalkerHeuristics.step_heuristic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Text.sample (cognitive 16) gymnasium/spaces/text.py:103— Text.sample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
passive_env_checker.env_render_passive_checker (cognitive 16) gymnasium/utils/passive_env_checker.py:405— passive_env_checker.env_render_passive_checker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.rescale_box (cognitive 16) gymnasium/wrappers/utils.py:160— utils.rescale_box has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
HumanRendering._render_frame (cognitive 16) gymnasium/wrappers/vector/rendering.py:102— HumanRendering._render_frame has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (3 pts), error handling 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication· Near-duplicate member family (4 members, 30 shared lines) · ×1
Near-duplicate member family (4 members, 30 shared lines) gymnasium/envs/classic_control/acrobot.py:296— gymnasium/envs/classic_control/acrobot.py:296-378 | gymnasium/envs/classic_control/cartpole.py:252-346 | gymnasium/envs/classic_control/continuous_mountain_car.py:201-301 | gymnasium/envs/classic_control/mountain_car.py:177-277 — These 4 members are variants of one another: a block of 30 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 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· Near-duplicate member family (4 members, 27 shared lines) · ×1
Near-duplicate member family (4 members, 27 shared lines) gymnasium/envs/classic_control/cartpole.py:252— gymnasium/envs/classic_control/cartpole.py:252-346 | gymnasium/envs/classic_control/continuous_mountain_car.py:201-301 | gymnasium/envs/classic_control/mountain_car.py:177-277 | gymnasium/envs/classic_control/pendulum.py:174-270 — These 4 members are variants of one another: a block of 27 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 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· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (9 members, 50+ identical tokens) gymnasium/envs/mujoco/hopper_v4.py:161— gymnasium/envs/mujoco/hopper_v4.py:161-174 | gymnasium/envs/mujoco/hopper_v5.py:325-338 | gymnasium/envs/mujoco/humanoid_v4.py:171-183 | gymnasium/envs/mujoco/humanoid_v5.py:522-534 | gymnasium/envs/mujoco/humanoidstandup_v5.py:466-478 | gymnasium/envs/mujoco/swimmer_v4.py:105-118 | gymnasium/envs/mujoco/swimmer_v5.py:274-287 | gymnasium/envs/mujoco/walker2d_v4.py:153-166 | gymnasium/envs/mujoco/walker2d_v5.py:324-337 — These 9 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 9 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 9 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) gymnasium/envs/mujoco/ant_v4.py:181— gymnasium/envs/mujoco/ant_v4.py:181-195 | gymnasium/envs/mujoco/ant_v5.py:406-420 | gymnasium/envs/mujoco/half_cheetah_v4.py:112-126 | gymnasium/envs/mujoco/half_cheetah_v5.py:265-279 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (69 corresponding lines) · ×1
Edited copy of a member (69 corresponding lines) gymnasium/envs/classic_control/cartpole.py:518— gymnasium/envs/classic_control/cartpole.py:518-608 | gymnasium/envs/phys2d/cartpole.py:159-227 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (65 corresponding lines) · ×1
Edited copy of a member (65 corresponding lines) gymnasium/spaces/box.py:239— gymnasium/spaces/box.py:239-303 | gymnasium/spaces/box.py:308-372 — These two members are one piece of code written twice and then edited apart: 65 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) gymnasium/envs/classic_control/cartpole.py:167— gymnasium/envs/classic_control/cartpole.py:167-228 | gymnasium/envs/classic_control/cartpole.py:434-495 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) gymnasium/wrappers/transform_action.py:266— gymnasium/wrappers/transform_action.py:266-315 | gymnasium/wrappers/transform_observation.py:828-873 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (84 corresponding lines) · ×1
Edited copy of a member (84 corresponding lines) gymnasium/envs/mujoco/humanoid_v5.py:329— gymnasium/envs/mujoco/humanoid_v5.py:329-413 | gymnasium/envs/mujoco/humanoidstandup_v5.py:304-387 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) gymnasium/spaces/oneof.py:68— gymnasium/spaces/oneof.py:68-109 | gymnasium/spaces/tuple.py:57-95 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) gymnasium/envs/classic_control/continuous_mountain_car.py:118— gymnasium/envs/classic_control/continuous_mountain_car.py:118-149 | gymnasium/envs/classic_control/mountain_car.py:110-131 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) gymnasium/envs/mujoco/half_cheetah_v4.py:35— gymnasium/envs/mujoco/half_cheetah_v4.py:35-70 | gymnasium/envs/mujoco/swimmer_v4.py:31-58 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×1
Edited copy of a member (16 corresponding lines) gymnasium/spaces/utils.py:418— gymnasium/spaces/utils.py:418-433 | gymnasium/spaces/utils.py:438-454 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) gymnasium/wrappers/rendering.py:495— gymnasium/wrappers/rendering.py:495-518 | gymnasium/wrappers/vector/rendering.py:51-76 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 22+ corresponding lines) · ×1
Edited copies of one member (3 members, 22+ corresponding lines) gymnasium/envs/mujoco/ant_v5.py:348— gymnasium/envs/mujoco/ant_v5.py:348-370 | gymnasium/envs/mujoco/swimmer_v4.py:65-92 | gymnasium/envs/mujoco/swimmer_v5.py:227-248 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×1
Edited copy of a member (15 corresponding lines) gymnasium/wrappers/rendering.py:348— gymnasium/wrappers/rendering.py:348-362 | gymnasium/wrappers/vector/rendering.py:432-451 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×1
Edited copy of a member (12 corresponding lines) gymnasium/envs/functional_jax_env.py:60— gymnasium/envs/functional_jax_env.py:60-71 | gymnasium/envs/functional_jax_env.py:169-184 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 25+ corresponding lines) · ×1
Edited copies of one member (4 members, 25+ corresponding lines) gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:156— gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:156-180 | gymnasium/envs/mujoco/inverted_pendulum_v5.py:130-157 | gymnasium/envs/mujoco/pusher_v5.py:180-213 | gymnasium/envs/mujoco/reacher_v5.py:159-191 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×1
Edited copy of a member (14 corresponding lines) gymnasium/envs/classic_control/acrobot.py:200— gymnasium/envs/classic_control/acrobot.py:200-214 | gymnasium/envs/classic_control/cartpole.py:236-249 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) gymnasium/wrappers/rendering.py:697— gymnasium/wrappers/rendering.py:697-725 | gymnasium/wrappers/stateful_reward.py:83-115 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) gymnasium/wrappers/common.py:156— gymnasium/wrappers/common.py:156-172 | gymnasium/wrappers/common.py:370-386 | gymnasium/wrappers/common.py:481-497 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) gymnasium/envs/mujoco/inverted_pendulum_v4.py:27— gymnasium/envs/mujoco/inverted_pendulum_v4.py:27-36 | gymnasium/envs/mujoco/pusher_v4.py:28-42 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 8+ corresponding lines) · ×1
Edited copies of one member (4 members, 8+ corresponding lines) gymnasium/envs/mujoco/half_cheetah_v4.py:102— gymnasium/envs/mujoco/half_cheetah_v4.py:102-109 | gymnasium/envs/mujoco/half_cheetah_v5.py:255-262 | gymnasium/envs/mujoco/swimmer_v4.py:95-102 | gymnasium/envs/mujoco/swimmer_v5.py:264-271 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) gymnasium/envs/mujoco/ant_v5.py:373— gymnasium/envs/mujoco/ant_v5.py:373-390 | gymnasium/envs/mujoco/humanoid_v5.py:502-519 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×1
Edited copy of a member (17 corresponding lines) gymnasium/wrappers/array_conversion.py:254— gymnasium/wrappers/array_conversion.py:254-270 | gymnasium/wrappers/vector/array_conversion.py:96-114 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×1
Edited copy of a member (7 corresponding lines) gymnasium/wrappers/rendering.py:586— gymnasium/wrappers/rendering.py:586-592 | gymnasium/wrappers/vector/rendering.py:206-212 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (43 lines × 2) gymnasium/envs/mujoco/humanoid_v5.py:371— gymnasium/envs/mujoco/humanoid_v5.py:371-413 | gymnasium/envs/mujoco/humanoidstandup_v5.py:345-387 — before extracting anything, compare `gymnasium/envs/mujoco/humanoid_v5.py` and `gymnasium/envs/mujoco/humanoidstandup_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 91 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 (42 lines × 2) gymnasium/envs/mujoco/half_cheetah_v5.py:167— gymnasium/envs/mujoco/half_cheetah_v5.py:167-208 | gymnasium/envs/mujoco/swimmer_v5.py:166-207 — 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 `gymnasium/envs/mujoco/half_cheetah_v5.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 (40 lines × 3) gymnasium/envs/mujoco/half_cheetah_v5.py:182— gymnasium/envs/mujoco/half_cheetah_v5.py:182-221 | gymnasium/envs/mujoco/hopper_v5.py:209-248 | gymnasium/envs/mujoco/walker2d_v5.py:213-252 — before extracting anything, compare `gymnasium/envs/mujoco/half_cheetah_v5.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 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, `gymnasium/envs/mujoco/hopper_v5.py:251` calls `healthy_reward` and `gymnasium/envs/mujoco/half_cheetah_v5.py:223` 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 (47 lines × 2) gymnasium/envs/classic_control/continuous_mountain_car.py:222— gymnasium/envs/classic_control/continuous_mountain_car.py:222-268 | gymnasium/envs/classic_control/mountain_car.py:198-244 — before extracting anything, compare `gymnasium/envs/classic_control/continuous_mountain_car.py` and `gymnasium/envs/classic_control/mountain_car.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 160 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 `gymnasium/envs/classic_control/continuous_mountain_car.py:222` 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 (34 lines × 2) gymnasium/envs/mujoco/humanoid_v5.py:439— gymnasium/envs/mujoco/humanoid_v5.py:439-472 | gymnasium/envs/mujoco/humanoidstandup_v5.py:390-423 — before extracting anything, compare `gymnasium/envs/mujoco/humanoid_v5.py` and `gymnasium/envs/mujoco/humanoidstandup_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (4–32 lines × 3) gymnasium/envs/classic_control/continuous_mountain_car.py:263— gymnasium/envs/classic_control/continuous_mountain_car.py:263-294 | gymnasium/envs/classic_control/mountain_car.py:239-270 | gymnasium/envs/classic_control/pendulum.py:229-232 — before extracting anything, compare `gymnasium/envs/classic_control/continuous_mountain_car.py` and `gymnasium/envs/classic_control/mountain_car.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 160 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 `gymnasium/envs/classic_control/pendulum.py:229` 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 (29 lines × 2) gymnasium/envs/mujoco/hopper_v4.py:42— gymnasium/envs/mujoco/hopper_v4.py:42-70 | gymnasium/envs/mujoco/hopper_v5.py:185-213 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 57 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 `gymnasium/envs/mujoco/hopper_v4.py:42` 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 (28 lines × 4) gymnasium/envs/mujoco/half_cheetah_v5.py:182— gymnasium/envs/mujoco/half_cheetah_v5.py:182-209 | gymnasium/envs/mujoco/hopper_v5.py:209-236 | gymnasium/envs/mujoco/swimmer_v5.py:181-208 | gymnasium/envs/mujoco/walker2d_v5.py:213-240 — before extracting anything, compare `gymnasium/envs/mujoco/half_cheetah_v5.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 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 `gymnasium/envs/mujoco/half_cheetah_v5.py:182` 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 (26 lines × 2) gymnasium/envs/mujoco/walker2d_v4.py:41— gymnasium/envs/mujoco/walker2d_v4.py:41-66 | gymnasium/envs/mujoco/walker2d_v5.py:192-217 — before extracting anything, compare `gymnasium/envs/mujoco/walker2d_v4.py` and `gymnasium/envs/mujoco/walker2d_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 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 `gymnasium/envs/mujoco/walker2d_v4.py:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–26 lines × 2) gymnasium/wrappers/rendering.py:409— gymnasium/wrappers/rendering.py:409-434 | gymnasium/wrappers/vector/rendering.py:520-544 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 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 (25 lines × 2) gymnasium/envs/mujoco/ant_v5.py:279— gymnasium/envs/mujoco/ant_v5.py:279-303 | gymnasium/envs/mujoco/humanoid_v5.py:367-391 — 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 `gymnasium/envs/mujoco/ant_v5.py:279` 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 (23–25 lines × 2) gymnasium/envs/mujoco/half_cheetah_v4.py:35— gymnasium/envs/mujoco/half_cheetah_v4.py:35-59 | gymnasium/envs/mujoco/swimmer_v4.py:31-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/envs/mujoco/half_cheetah_v4.py:35` 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 (45 lines × 2) gymnasium/envs/classic_control/cartpole.py:292— gymnasium/envs/classic_control/cartpole.py:292-336 | gymnasium/envs/classic_control/cartpole.py:558-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 (22 lines × 2) gymnasium/spaces/box.py:282— gymnasium/spaces/box.py:282-303 | gymnasium/spaces/box.py:351-372 — both copies are in the same file, so extract the 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 (21 lines × 3) gymnasium/envs/classic_control/cartpole.py:258— gymnasium/envs/classic_control/cartpole.py:258-278 | gymnasium/envs/classic_control/continuous_mountain_car.py:207-227 | gymnasium/envs/classic_control/mountain_car.py:183-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/envs/classic_control/cartpole.py:258` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–21 lines × 2) gymnasium/envs/mujoco/ant_v5.py:352— gymnasium/envs/mujoco/ant_v5.py:352-370 | gymnasium/envs/mujoco/humanoid_v5.py:479-499 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20 lines × 5) gymnasium/envs/classic_control/acrobot.py:297— gymnasium/envs/classic_control/acrobot.py:297-316 | gymnasium/envs/classic_control/cartpole.py:253-272 | gymnasium/envs/classic_control/continuous_mountain_car.py:202-221 | gymnasium/envs/classic_control/mountain_car.py:178-197 | gymnasium/envs/classic_control/pendulum.py:175-194 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/envs/classic_control/cartpole.py:253` 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 (14–20 lines × 5) gymnasium/envs/mujoco/half_cheetah_v4.py:48— gymnasium/envs/mujoco/half_cheetah_v4.py:48-67 | gymnasium/envs/mujoco/hopper_v4.py:66-85 | gymnasium/envs/mujoco/humanoid_v4.py:64-83 | gymnasium/envs/mujoco/swimmer_v4.py:43-56 | gymnasium/envs/mujoco/walker2d_v4.py:62-81 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/walker2d_v4.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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 `gymnasium/envs/mujoco/half_cheetah_v4.py:48` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20 lines × 3) gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:161— gymnasium/envs/mujoco/inverted_double_pendulum_v5.py:161-180 | gymnasium/envs/mujoco/pusher_v5.py:194-213 | gymnasium/envs/mujoco/reacher_v5.py:172-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `gymnasium/envs/mujoco/reacher_v5.py:198` calls `mj_kinematics` and `gymnasium/envs/mujoco/pusher_v5.py:218` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) gymnasium/spaces/box.py:261— gymnasium/spaces/box.py:261-277 | gymnasium/spaces/box.py:330-346 — both copies are in the same file, so extract the 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 × 7) gymnasium/envs/box2d/bipedal_walker.py:621— gymnasium/envs/box2d/bipedal_walker.py:621-636 | gymnasium/envs/box2d/lunar_lander.py:685-700 | gymnasium/envs/classic_control/acrobot.py:296-311 | gymnasium/envs/classic_control/cartpole.py:252-267 | gymnasium/envs/classic_control/continuous_mountain_car.py:201-216 | gymnasium/envs/classic_control/mountain_car.py:177-192 | gymnasium/envs/classic_control/pendulum.py:174-189 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note 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, `gymnasium/envs/classic_control/continuous_mountain_car.py:197` calls `_height`, `sin` and `gymnasium/envs/classic_control/cartpole.py:249` 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 (16 lines × 3) gymnasium/vector/async_vector_env.py:386— gymnasium/vector/async_vector_env.py:386-401 | gymnasium/vector/sync_vector_env.py:225-240 | gymnasium/wrappers/vector/common.py:130-145 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `gymnasium/wrappers/vector/common.py:147` calls `perf_counter` and `gymnasium/vector/sync_vector_env.py:242` 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 (15 lines × 4) gymnasium/envs/mujoco/ant_v4.py:181— gymnasium/envs/mujoco/ant_v4.py:181-195 | gymnasium/envs/mujoco/ant_v5.py:406-420 | gymnasium/envs/mujoco/half_cheetah_v4.py:112-126 | gymnasium/envs/mujoco/half_cheetah_v5.py:265-279 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14–15 lines × 2) gymnasium/wrappers/rendering.py:544— gymnasium/wrappers/rendering.py:544-557 | gymnasium/wrappers/vector/rendering.py:103-117 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gymnasium/wrappers/rendering.py:539` calls `render` and `gymnasium/wrappers/vector/rendering.py:100` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 9) gymnasium/envs/mujoco/hopper_v4.py:161— gymnasium/envs/mujoco/hopper_v4.py:161-174 | gymnasium/envs/mujoco/hopper_v5.py:325-338 | gymnasium/envs/mujoco/humanoid_v4.py:171-183 | gymnasium/envs/mujoco/humanoid_v5.py:522-534 | gymnasium/envs/mujoco/humanoidstandup_v5.py:466-478 | gymnasium/envs/mujoco/swimmer_v4.py:105-118 | gymnasium/envs/mujoco/swimmer_v5.py:274-287 | gymnasium/envs/mujoco/walker2d_v4.py:153-166 | gymnasium/envs/mujoco/walker2d_v5.py:324-337 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 57 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 (14 lines × 2) gymnasium/envs/mujoco/hopper_v4.py:103— gymnasium/envs/mujoco/hopper_v4.py:103-116 | gymnasium/envs/mujoco/hopper_v5.py:260-273 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 57 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 (10–12 lines × 2) gymnasium/envs/mujoco/humanoidstandup_v4.py:29— gymnasium/envs/mujoco/humanoidstandup_v4.py:29-40 | gymnasium/envs/mujoco/inverted_double_pendulum_v4.py:28-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 3) gymnasium/envs/mujoco/inverted_pendulum_v4.py:27— gymnasium/envs/mujoco/inverted_pendulum_v4.py:27-36 | gymnasium/envs/mujoco/pusher_v4.py:32-42 | gymnasium/envs/mujoco/reacher_v4.py:25-34 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gymnasium/envs/mujoco/pusher_v4.py:29` calls `ImportError` and `gymnasium/envs/mujoco/inverted_pendulum_v4.py:26` 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 (9–11 lines × 2) gymnasium/envs/box2d/car_dynamics.py:299— gymnasium/envs/box2d/car_dynamics.py:299-307 | gymnasium/envs/box2d/car_dynamics.py:334-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 3) gymnasium/envs/classic_control/cartpole.py:304— gymnasium/envs/classic_control/cartpole.py:304-315 | gymnasium/envs/classic_control/cartpole.py:570-581 | gymnasium/envs/phys2d/cartpole.py:190-201 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 4) gymnasium/envs/classic_control/acrobot.py:370— gymnasium/envs/classic_control/acrobot.py:370-378 | gymnasium/envs/classic_control/cartpole.py:338-346 | gymnasium/envs/classic_control/continuous_mountain_car.py:293-301 | gymnasium/envs/classic_control/mountain_car.py:269-277 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gymnasium/envs/classic_control/cartpole.py:334` calls `hline` and `gymnasium/envs/classic_control/continuous_mountain_car.py:289` 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) gymnasium/envs/mujoco/half_cheetah_v4.py:77— gymnasium/envs/mujoco/half_cheetah_v4.py:77-84 | gymnasium/envs/mujoco/hopper_v4.py:134-141 | gymnasium/envs/mujoco/walker2d_v4.py:126-133 — before extracting anything, compare `gymnasium/envs/mujoco/hopper_v4.py` and `gymnasium/envs/mujoco/walker2d_v4.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) gymnasium/envs/mujoco/half_cheetah_v5.py:228— gymnasium/envs/mujoco/half_cheetah_v5.py:228-234 | gymnasium/envs/mujoco/hopper_v5.py:286-292 | gymnasium/envs/mujoco/walker2d_v5.py:286-292 — before extracting anything, compare `gymnasium/envs/mujoco/half_cheetah_v5.py` and `gymnasium/envs/mujoco/hopper_v5.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–7 lines × 2) gymnasium/envs/box2d/bipedal_walker.py:761— gymnasium/envs/box2d/bipedal_walker.py:761-766 | gymnasium/envs/box2d/lunar_lander.py:791-797 — 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 `gymnasium/envs/box2d/bipedal_walker.py:761` 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 (6 lines × 4) gymnasium/envs/classic_control/cartpole.py:336— gymnasium/envs/classic_control/cartpole.py:336-341 | gymnasium/envs/classic_control/continuous_mountain_car.py:291-296 | gymnasium/envs/classic_control/mountain_car.py:267-272 | gymnasium/envs/classic_control/pendulum.py:260-265 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `gymnasium/envs/classic_control/cartpole.py:334` calls `hline` and `gymnasium/envs/classic_control/continuous_mountain_car.py:289` 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 (4–5 lines × 3) gymnasium/envs/classic_control/cartpole.py:293— gymnasium/envs/classic_control/cartpole.py:293-297 | gymnasium/envs/classic_control/cartpole.py:559-563 | gymnasium/envs/phys2d/cartpole.py:181-184 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. 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 (13 lines × 2) gymnasium/envs/toy_text/cliffwalking.py:226— gymnasium/envs/toy_text/cliffwalking.py:226-238 | gymnasium/envs/toy_text/frozen_lake.py:352-364 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 5) gymnasium/vector/utils/shared_memory.py:50— gymnasium/vector/utils/shared_memory.py:50-72 | gymnasium/vector/utils/shared_memory.py:148-174 | gymnasium/vector/utils/shared_memory.py:260-279 | gymnasium/vector/utils/space_utils.py:308-338 | gymnasium/wrappers/utils.py:76-94 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `gymnasium/vector/utils/shared_memory.py:148` 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 first that the copies are not typed on the same thing: the declarations holding them bind `space` to `Space[Any]` in one and `Space` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `gymnasium/vector/utils/space_utils.py:342` calls `_iterate_discrete`, `TypeError` and `gymnasium/vector/utils/shared_memory.py:76` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) gymnasium/wrappers/rendering.py:382— gymnasium/wrappers/rendering.py:382-392 | gymnasium/wrappers/vector/rendering.py:493-503 — before extracting anything, compare `gymnasium/wrappers/rendering.py` and `gymnasium/wrappers/vector/rendering.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 99 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 (10 lines × 3) gymnasium/envs/phys2d/pendulum.py:251— gymnasium/envs/phys2d/pendulum.py:251-261 | gymnasium/envs/tabular/blackjack.py:446-455 | gymnasium/envs/tabular/cliffwalking.py:349-358 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (16 lines × 2) gymnasium/wrappers/transform_action.py:57— gymnasium/wrappers/transform_action.py:57-72 | gymnasium/wrappers/transform_observation.py:78-93 — 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.
Low cohesion: Env (LCOM4 4) gymnasium/core.py:30— Env's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Duplicated predicate gymnasium/envs/mujoco/ant_v5.py:357— `(not self.is_healthy) and self._terminate_when_unhealthy` appears character-identically in 4 files — gymnasium/envs/mujoco/ant_v5.py, gymnasium/envs/mujoco/hopper_v5.py, gymnasium/envs/mujoco/humanoid_v5.py, gymnasium/envs/mujoco/walker2d_v5.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 gymnasium/utils/save_video.py:93— `episode_trigger is None and step_trigger is None` appears character-identically in 3 files — gymnasium/utils/save_video.py, gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/vector/async_vector_env.py:232— `isinstance(observation_mode, tuple) and len(observation_mode) == 2` appears character-identically in 2 files — gymnasium/vector/async_vector_env.py, gymnasium/vector/sync_vector_env.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 gymnasium/spaces/dict.py:198— `mask is not None and probability is not None` appears character-identically in 9 files — gymnasium/spaces/dict.py, gymnasium/spaces/discrete.py, gymnasium/spaces/graph.py, gymnasium/spaces/multi_binary.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 gymnasium/vector/async_vector_env.py:233— `not isinstance(observation_mode[0], Space) or not isinstance( observation_mode[1], Space )` appears character-identically in 2 files — gymnasium/vector/async_vector_env.py, gymnasium/vector/sync_vector_env.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 gymnasium/wrappers/transform_action.py:282— `np.any(np.isinf(self.low)) or np.any(np.isinf(self.high))` appears character-identically in 2 files — gymnasium/wrappers/transform_action.py, gymnasium/wrappers/transform_observation.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 gymnasium/envs/mujoco/ant_v4.py:119— `np.isfinite(state).all() and min_z <= state[2] <= max_z` appears character-identically in 2 files — gymnasium/envs/mujoco/ant_v4.py, gymnasium/envs/mujoco/ant_v5.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 gymnasium/vector/async_vector_env.py:384— `options is not None and "reset_mask" in options` appears character-identically in 5 files — gymnasium/vector/async_vector_env.py, gymnasium/vector/sync_vector_env.py, gymnasium/vector/vector_env.py, gymnasium/wrappers/vector/stateful_observation.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 gymnasium/envs/classic_control/continuous_mountain_car.py:166— `position == self.min_position and velocity < 0` appears character-identically in 2 files — gymnasium/envs/classic_control/continuous_mountain_car.py, gymnasium/envs/classic_control/mountain_car.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 gymnasium/envs/classic_control/continuous_mountain_car.py:171— `position >= self.goal_position and velocity >= self.goal_velocity` appears character-identically in 2 files — gymnasium/envs/classic_control/continuous_mountain_car.py, gymnasium/envs/classic_control/mountain_car.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 gymnasium/utils/env_checker.py:165— `seed_param is not None and seed_param.default is not None` appears character-identically in 2 files — gymnasium/utils/env_checker.py, gymnasium/utils/passive_env_checker.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 gymnasium/wrappers/vector/stateful_observation.py:168— `self.autoreset_mode == AutoresetMode.SAME_STEP and "final_obs" in infos` appears character-identically in 2 files — gymnasium/wrappers/vector/stateful_observation.py, gymnasium/wrappers/vector/vectorize_observation.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 gymnasium/wrappers/rendering.py:355— `self.episode_trigger and self.episode_trigger(self.episode_id)` appears character-identically in 2 files — gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/wrappers/rendering.py:433— `self.gc_trigger and self.gc_trigger(self.episode_id)` appears character-identically in 2 files — gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/envs/mujoco/ant_v4.py:93— `self.is_healthy or self._terminate_when_unhealthy` appears character-identically in 4 files — gymnasium/envs/mujoco/ant_v4.py, gymnasium/envs/mujoco/hopper_v4.py, gymnasium/envs/mujoco/humanoid_v4.py, gymnasium/envs/mujoco/walker2d_v4.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 gymnasium/wrappers/rendering.py:384— `self.recording and isinstance(render_out, list)` appears character-identically in 2 files — gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/wrappers/rendering.py:352— `self.recording and self.video_length == float("inf")` appears character-identically in 2 files — gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/envs/box2d/bipedal_walker.py:638— `self.screen is None and self.render_mode == "human"` appears character-identically in 2 files — gymnasium/envs/box2d/bipedal_walker.py, gymnasium/envs/box2d/lunar_lander.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 gymnasium/wrappers/rendering.py:371— `self.step_trigger and self.step_trigger(self.step_id)` appears character-identically in 2 files — gymnasium/wrappers/rendering.py, gymnasium/wrappers/vector/rendering.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 gymnasium/envs/box2d/bipedal_walker.py:870— `steps % 20 == 0 or terminated or truncated` appears character-identically in 2 files — gymnasium/envs/box2d/bipedal_walker.py, gymnasium/envs/box2d/lunar_lander.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 gymnasium/envs/registration.py:765— `str(env.__class__.__base__) == "<class 'gym.core.Env'>" or str(env.__class__.__base__) == "<class 'gym.core.Wrapper'>"` appears character-identically in 2 files — gymnasium/envs/registration.py, gymnasium/utils/env_checker.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.
Orphaned file gymnasium/envs/tabular/blackjack.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 gymnasium/envs/box2d/car_dynamics.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 gymnasium/envs/phys2d/cartpole.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 gymnasium/envs/phys2d/pendulum.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 gymnasium/envs/functional_jax_env.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 gymnasium/wrappers/jax_to_numpy.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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 1 significant file(s) lose their only recent owner: gymnasium/utils/performance.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 pyproject.toml:1— `(repository root)` (28609 LoC, 228 module-visible types across 16 directories) overshoots its size bounds. 1 of 2 build unit(s) (Python) overshoot their size bounds, lowering Project Cohesion to 0.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Scattered collaborators — 63 % of calls cross a namespace and only 36 % of collaborators are co-located — group each feature's code into a vertical slice so a call's collaborators sit together.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 6 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: gymnasium/envs/tabular/blackjack.py, gymnasium/envs/box2d/car_dynamics.py, gymnasium/envs/phys2d/cartpole.py, gymnasium/envs/phys2d/pendulum.py, gymnasium/envs/functional_jax_env.py, gymnasium/wrappers/jax_to_numpy.py (7 orphaned of 93 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; 93 of the 120 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.
Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `docs`.
No SAST REDACTED:12— 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 8 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.
P3 · Security & performance tooling· Dependabot does not watch pip · ×1
Dependabot does not watch pip REDACTED:7— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
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.)
Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 4 shipped distribution(s) across 2 manifest(s) (31 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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1e877-1237-7898-937a-6e70f7d16bba · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 31 · Warnings: 282 · Recommendations: 38 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 07:44 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.